mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
keditbookmarks: adjust to bookmark classes changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
16ab1a1ccb
commit
2dff528754
7 changed files with 5 additions and 54 deletions
|
@ -143,11 +143,6 @@ void KEBApp::createActions() {
|
||||||
m_actionsImplSort->setText(i18n("&Sort Alphabetically"));
|
m_actionsImplSort->setText(i18n("&Sort Alphabetically"));
|
||||||
connect(m_actionsImplSort, SIGNAL(triggered()), m_actionsImpl, SLOT(slotSort()));
|
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");
|
KAction* m_actionsImplExpandAll = actionCollection()->addAction("expandall");
|
||||||
m_actionsImplExpandAll->setText(i18n("&Expand All Folders"));
|
m_actionsImplExpandAll->setText(i18n("&Expand All Folders"));
|
||||||
connect(m_actionsImplExpandAll, SIGNAL(triggered()), m_actionsImpl, SLOT(slotExpandAll()));
|
connect(m_actionsImplExpandAll, SIGNAL(triggered()), m_actionsImpl, SLOT(slotExpandAll()));
|
||||||
|
@ -433,14 +428,6 @@ void ActionsImpl::slotChangeComment() {
|
||||||
KEBApp::self()->startEdit( KEBApp::CommentColumn );
|
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() {
|
void ActionsImpl::slotChangeIcon() {
|
||||||
KEBApp::self()->bkInfo()->commitChanges();
|
KEBApp::self()->bkInfo()->commitChanges();
|
||||||
KBookmark bk = KEBApp::self()->firstSelected();
|
KBookmark bk = KEBApp::self()->firstSelected();
|
||||||
|
|
|
@ -55,7 +55,6 @@ public Q_SLOTS:
|
||||||
void slotNewBookmark();
|
void slotNewBookmark();
|
||||||
void slotInsertSeparator();
|
void slotInsertSeparator();
|
||||||
void slotSort();
|
void slotSort();
|
||||||
void slotSetAsToolbar();
|
|
||||||
void slotOpenLink();
|
void slotOpenLink();
|
||||||
void slotTestSelection();
|
void slotTestSelection();
|
||||||
void slotTestAll();
|
void slotTestAll();
|
||||||
|
|
|
@ -178,7 +178,6 @@ EditCommand::EditCommand(KBookmarkModel* model, const QString & address, int col
|
||||||
else
|
else
|
||||||
mNewValue = newValue;
|
mNewValue = newValue;
|
||||||
|
|
||||||
// -2 is "toolbar" attribute change, but that's only used internally.
|
|
||||||
if (mCol == -1)
|
if (mCol == -1)
|
||||||
setText(i18nc("(qtundo-format)", "Icon Change"));
|
setText(i18nc("(qtundo-format)", "Icon Change"));
|
||||||
else if (mCol == 0)
|
else if (mCol == 0)
|
||||||
|
@ -192,13 +191,7 @@ EditCommand::EditCommand(KBookmarkModel* model, const QString & address, int col
|
||||||
void EditCommand::redo()
|
void EditCommand::redo()
|
||||||
{
|
{
|
||||||
KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress);
|
KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress);
|
||||||
if(mCol==-2)
|
if(mCol==-1)
|
||||||
{
|
|
||||||
if (mOldValue.isEmpty())
|
|
||||||
mOldValue = bk.internalElement().attribute("toolbar");
|
|
||||||
bk.internalElement().setAttribute("toolbar", mNewValue);
|
|
||||||
}
|
|
||||||
else if(mCol==-1)
|
|
||||||
{
|
{
|
||||||
if (mOldValue.isEmpty())
|
if (mOldValue.isEmpty())
|
||||||
mOldValue = bk.icon();
|
mOldValue = bk.icon();
|
||||||
|
@ -232,11 +225,7 @@ void EditCommand::undo()
|
||||||
{
|
{
|
||||||
kDebug() << "Setting old value" << mOldValue << "in bk" << mAddress << "col" << mCol;
|
kDebug() << "Setting old value" << mOldValue << "in bk" << mAddress << "col" << mCol;
|
||||||
KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress);
|
KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress);
|
||||||
if(mCol==-2)
|
if(mCol==-1)
|
||||||
{
|
|
||||||
bk.internalElement().setAttribute("toolbar", mOldValue);
|
|
||||||
}
|
|
||||||
else if(mCol==-1)
|
|
||||||
{
|
{
|
||||||
bk.setIcon(mOldValue);
|
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* CmdGen::insertMimeSource(KBookmarkModel* model, const QString &cmdName, const QMimeData *data, const QString &addr)
|
||||||
{
|
{
|
||||||
KEBMacroCommand *mcmd = new KEBMacroCommand(cmdName);
|
KEBMacroCommand *mcmd = new KEBMacroCommand(cmdName);
|
||||||
|
|
|
@ -151,7 +151,6 @@ private:
|
||||||
// TODO RENAME -- or maybe move these to KBookmarkModel?
|
// TODO RENAME -- or maybe move these to KBookmarkModel?
|
||||||
class KBOOKMARKMODEL_EXPORT CmdGen {
|
class KBOOKMARKMODEL_EXPORT CmdGen {
|
||||||
public:
|
public:
|
||||||
static KEBMacroCommand* setAsToolbar(KBookmarkModel* model, const KBookmark &bk);
|
|
||||||
static KEBMacroCommand* insertMimeSource(KBookmarkModel* model, const QString &cmdName, const QMimeData *data, const QString &addr);
|
static KEBMacroCommand* insertMimeSource(KBookmarkModel* model, const QString &cmdName, const QMimeData *data, const QString &addr);
|
||||||
// TODO remove "bool copy"
|
// TODO remove "bool copy"
|
||||||
static KEBMacroCommand* itemsMoved(KBookmarkModel* model, const QList<KBookmark> & items, const QString &newAddress, bool copy);
|
static KEBMacroCommand* itemsMoved(KBookmarkModel* model, const QList<KBookmark> & items, const QString &newAddress, bool copy);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
||||||
<kpartgui name="keditbookmarks" version="27">
|
<kpartgui name="keditbookmarks" version="28">
|
||||||
|
|
||||||
<MenuBar>
|
<MenuBar>
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@
|
||||||
|
|
||||||
<Menu name="popup_folder">
|
<Menu name="popup_folder">
|
||||||
<!-- Stuff for folders -->
|
<!-- Stuff for folders -->
|
||||||
<Action name="setastoolbar"/>
|
|
||||||
<Action name="sort"/>
|
<Action name="sort"/>
|
||||||
<Action name="recursivesort"/>
|
<Action name="recursivesort"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
|
@ -134,7 +133,6 @@
|
||||||
<Action name="nexthit"/>
|
<Action name="nexthit"/>
|
||||||
<Action name="openlink"/>
|
<Action name="openlink"/>
|
||||||
<Action name="rename"/>
|
<Action name="rename"/>
|
||||||
<Action name="setastoolbar"/>
|
|
||||||
<Action name="sort"/>
|
<Action name="sort"/>
|
||||||
<Action name="recursivesort"/>
|
<Action name="recursivesort"/>
|
||||||
<Action name="settings_saveonclose"/>
|
<Action name="settings_saveonclose"/>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
||||||
<kpartgui name="keditbookmarks" version="32">
|
<kpartgui name="keditbookmarks" version="33">
|
||||||
|
|
||||||
<MenuBar>
|
<MenuBar>
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
||||||
<Action name="newfolder"/>
|
<Action name="newfolder"/>
|
||||||
<Action name="insertseparator"/>
|
<Action name="insertseparator"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<Action name="setastoolbar"/>
|
|
||||||
<Action name="sort"/>
|
<Action name="sort"/>
|
||||||
<Action name="recursivesort"/>
|
<Action name="recursivesort"/>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
@ -76,7 +75,6 @@
|
||||||
|
|
||||||
<Menu name="popup_folder">
|
<Menu name="popup_folder">
|
||||||
<!-- Stuff for folders -->
|
<!-- Stuff for folders -->
|
||||||
<Action name="setastoolbar"/>
|
|
||||||
<Action name="sort"/>
|
<Action name="sort"/>
|
||||||
<Action name="recursivesort"/>
|
<Action name="recursivesort"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
|
@ -160,7 +158,6 @@
|
||||||
<Action name="nexthit"/>
|
<Action name="nexthit"/>
|
||||||
<Action name="openlink"/>
|
<Action name="openlink"/>
|
||||||
<Action name="rename"/>
|
<Action name="rename"/>
|
||||||
<Action name="setastoolbar"/>
|
|
||||||
<Action name="sort"/>
|
<Action name="sort"/>
|
||||||
<Action name="recursivesort"/>
|
<Action name="recursivesort"/>
|
||||||
<Action name="testall"/>
|
<Action name="testall"/>
|
||||||
|
|
|
@ -259,7 +259,7 @@ void KEBApp::setActionsEnabled(SelcAbilities sa) {
|
||||||
if (sa.singleSelect) {
|
if (sa.singleSelect) {
|
||||||
toEnable << "newfolder" << "newbookmark" << "insertseparator";
|
toEnable << "newfolder" << "newbookmark" << "insertseparator";
|
||||||
if (sa.group)
|
if (sa.group)
|
||||||
toEnable << "sort" << "recursivesort" << "setastoolbar";
|
toEnable << "sort" << "recursivesort";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue