From 2dff5287549da7e9065e9d37a1f9fc36052a6b6e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 8 Jun 2023 16:28:59 +0300 Subject: [PATCH] keditbookmarks: adjust to bookmark classes changes Signed-off-by: Ivailo Monev --- keditbookmarks/actionsimpl.cpp | 13 --------- keditbookmarks/actionsimpl.h | 1 - keditbookmarks/kbookmarkmodel/commands.cpp | 33 ++-------------------- keditbookmarks/kbookmarkmodel/commands.h | 1 - keditbookmarks/keditbookmarks-genui.rc | 4 +-- keditbookmarks/keditbookmarksui.rc | 5 +--- keditbookmarks/toplevel.cpp | 2 +- 7 files changed, 5 insertions(+), 54 deletions(-) diff --git a/keditbookmarks/actionsimpl.cpp b/keditbookmarks/actionsimpl.cpp index 95781478..08b72dfa 100644 --- a/keditbookmarks/actionsimpl.cpp +++ b/keditbookmarks/actionsimpl.cpp @@ -143,11 +143,6 @@ void KEBApp::createActions() { m_actionsImplSort->setText(i18n("&Sort Alphabetically")); connect(m_actionsImplSort, SIGNAL(triggered()), m_actionsImpl, SLOT(slotSort())); - KAction* m_actionsImplSetAsToolbar = actionCollection()->addAction("setastoolbar"); - m_actionsImplSetAsToolbar->setIcon(KIcon("bookmark-toolbar")); - m_actionsImplSetAsToolbar->setText(i18n("Set as T&oolbar Folder")); - connect(m_actionsImplSetAsToolbar, SIGNAL(triggered()), m_actionsImpl, SLOT(slotSetAsToolbar())); - KAction* m_actionsImplExpandAll = actionCollection()->addAction("expandall"); m_actionsImplExpandAll->setText(i18n("&Expand All Folders")); connect(m_actionsImplExpandAll, SIGNAL(triggered()), m_actionsImpl, SLOT(slotExpandAll())); @@ -433,14 +428,6 @@ void ActionsImpl::slotChangeComment() { KEBApp::self()->startEdit( KEBApp::CommentColumn ); } -void ActionsImpl::slotSetAsToolbar() { - KEBApp::self()->bkInfo()->commitChanges(); - KBookmark bk = KEBApp::self()->firstSelected(); - Q_ASSERT(bk.isGroup()); - QUndoCommand *mcmd = CmdGen::setAsToolbar(m_model, bk); - commandHistory()->addCommand(mcmd); -} - void ActionsImpl::slotChangeIcon() { KEBApp::self()->bkInfo()->commitChanges(); KBookmark bk = KEBApp::self()->firstSelected(); diff --git a/keditbookmarks/actionsimpl.h b/keditbookmarks/actionsimpl.h index 4a621b30..584bf6b8 100644 --- a/keditbookmarks/actionsimpl.h +++ b/keditbookmarks/actionsimpl.h @@ -55,7 +55,6 @@ public Q_SLOTS: void slotNewBookmark(); void slotInsertSeparator(); void slotSort(); - void slotSetAsToolbar(); void slotOpenLink(); void slotTestSelection(); void slotTestAll(); diff --git a/keditbookmarks/kbookmarkmodel/commands.cpp b/keditbookmarks/kbookmarkmodel/commands.cpp index bc1f2932..4a8777ef 100644 --- a/keditbookmarks/kbookmarkmodel/commands.cpp +++ b/keditbookmarks/kbookmarkmodel/commands.cpp @@ -178,7 +178,6 @@ EditCommand::EditCommand(KBookmarkModel* model, const QString & address, int col else mNewValue = newValue; - // -2 is "toolbar" attribute change, but that's only used internally. if (mCol == -1) setText(i18nc("(qtundo-format)", "Icon Change")); else if (mCol == 0) @@ -192,13 +191,7 @@ EditCommand::EditCommand(KBookmarkModel* model, const QString & address, int col void EditCommand::redo() { KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress); - if(mCol==-2) - { - if (mOldValue.isEmpty()) - mOldValue = bk.internalElement().attribute("toolbar"); - bk.internalElement().setAttribute("toolbar", mNewValue); - } - else if(mCol==-1) + if(mCol==-1) { if (mOldValue.isEmpty()) mOldValue = bk.icon(); @@ -232,11 +225,7 @@ void EditCommand::undo() { kDebug() << "Setting old value" << mOldValue << "in bk" << mAddress << "col" << mCol; KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress); - if(mCol==-2) - { - bk.internalElement().setAttribute("toolbar", mOldValue); - } - else if(mCol==-1) + if(mCol==-1) { bk.setIcon(mOldValue); } @@ -475,24 +464,6 @@ QString SortCommand::affectedBookmarks() const } /* -------------------------------------- */ - -KEBMacroCommand* CmdGen::setAsToolbar(KBookmarkModel* model, const KBookmark &bk) -{ - KEBMacroCommand *mcmd = new KEBMacroCommand(i18nc("(qtundo-format)", "Set as Bookmark Toolbar")); - - KBookmarkGroup oldToolbar = model->bookmarkManager()->toolbar(); - if (!oldToolbar.isNull()) - { - new EditCommand(model, oldToolbar.address(), -2, "no", mcmd); //toolbar - new EditCommand(model, oldToolbar.address(), -1, "", mcmd); //icon - } - - new EditCommand(model, bk.address(), -2, "yes", mcmd); - new EditCommand(model, bk.address(), -1, "bookmark-toolbar", mcmd); - - return mcmd; -} - KEBMacroCommand* CmdGen::insertMimeSource(KBookmarkModel* model, const QString &cmdName, const QMimeData *data, const QString &addr) { KEBMacroCommand *mcmd = new KEBMacroCommand(cmdName); diff --git a/keditbookmarks/kbookmarkmodel/commands.h b/keditbookmarks/kbookmarkmodel/commands.h index 031f4ccc..7e560fbc 100644 --- a/keditbookmarks/kbookmarkmodel/commands.h +++ b/keditbookmarks/kbookmarkmodel/commands.h @@ -151,7 +151,6 @@ private: // TODO RENAME -- or maybe move these to KBookmarkModel? class KBOOKMARKMODEL_EXPORT CmdGen { public: - static KEBMacroCommand* setAsToolbar(KBookmarkModel* model, const KBookmark &bk); static KEBMacroCommand* insertMimeSource(KBookmarkModel* model, const QString &cmdName, const QMimeData *data, const QString &addr); // TODO remove "bool copy" static KEBMacroCommand* itemsMoved(KBookmarkModel* model, const QList & items, const QString &newAddress, bool copy); diff --git a/keditbookmarks/keditbookmarks-genui.rc b/keditbookmarks/keditbookmarks-genui.rc index 815fd6fc..5746cacc 100644 --- a/keditbookmarks/keditbookmarks-genui.rc +++ b/keditbookmarks/keditbookmarks-genui.rc @@ -1,5 +1,5 @@ - + @@ -56,7 +56,6 @@ - @@ -134,7 +133,6 @@ - diff --git a/keditbookmarks/keditbookmarksui.rc b/keditbookmarks/keditbookmarksui.rc index cebcbbdc..0870a509 100644 --- a/keditbookmarks/keditbookmarksui.rc +++ b/keditbookmarks/keditbookmarksui.rc @@ -1,5 +1,5 @@ - + @@ -36,7 +36,6 @@ - @@ -76,7 +75,6 @@ - @@ -160,7 +158,6 @@ - diff --git a/keditbookmarks/toplevel.cpp b/keditbookmarks/toplevel.cpp index 617dd5da..0189bfd3 100644 --- a/keditbookmarks/toplevel.cpp +++ b/keditbookmarks/toplevel.cpp @@ -259,7 +259,7 @@ void KEBApp::setActionsEnabled(SelcAbilities sa) { if (sa.singleSelect) { toEnable << "newfolder" << "newbookmark" << "insertseparator"; if (sa.group) - toEnable << "sort" << "recursivesort" << "setastoolbar"; + toEnable << "sort" << "recursivesort"; } }