add more spacing
[personal-kdebase.git] / apps / keditbookmarks / actionsimpl.cpp
blob4569e3e4d6eba0267f7bb276db8e2395e41f95a1
1 // -*- indent-tabs-mode:nil -*-
2 // vim: set ts=4 sts=4 sw=4 et:
3 /* This file is part of the KDE project
4 Copyright (C) 2000 David Faure <faure@kde.org>
5 Copyright (C) 2002-2003 Alexander Kellett <lypanov@kde.org>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License version 2 as published by the Free Software Foundation.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #include "actionsimpl.h"
24 #include "toplevel.h"
25 #include "commands.h"
26 #include "importers.h"
27 #include "favicons.h"
28 #include "testlink.h"
29 #include "exporters.h"
30 #include "bookmarkinfo.h"
32 #include <stdlib.h>
34 #include <QtGui/QClipboard>
35 #include <QtCore/QMimeData>
36 #include <QtGui/QPainter>
38 #include <kdebug.h>
39 #include <kapplication.h>
41 #include <kaction.h>
42 #include <kactioncollection.h>
43 #include <kedittoolbar.h>
44 #include <kicon.h>
45 #include <kicondialog.h>
46 #include <kiconloader.h>
47 #include <kinputdialog.h>
48 #include <klocale.h>
49 #include <kstandardaction.h>
50 #include <kfiledialog.h>
51 #include <kmessagebox.h>
52 #include <krun.h>
53 #include <kstandarddirs.h>
54 #include <ktemporaryfile.h>
55 #include <ktoggleaction.h>
57 #include <kparts/part.h>
58 #include <kservicetypetrader.h>
60 #include <kbookmark.h>
61 #include <kbookmarkmanager.h>
62 #include <kbookmarkimporter.h>
64 #include <kbookmarkimporter_ie.h>
65 #include <kbookmarkimporter_opera.h>
66 #include <kbookmarkimporter_ns.h>
67 #include <kbookmarkexporter.h>
69 ActionsImpl* ActionsImpl::s_self = 0;
71 // decoupled from resetActions in toplevel.cpp
72 // as resetActions simply uses the action groups
73 // specified in the ui.rc file
74 void KEBApp::createActions() {
76 ActionsImpl *actn = ActionsImpl::self();
78 // save and quit should probably not be in the toplevel???
79 (void) KStandardAction::quit(
80 this, SLOT( close() ), actionCollection());
81 KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
82 (void) KStandardAction::configureToolbars(
83 this, SLOT( slotConfigureToolbars() ), actionCollection());
85 if (m_browser) {
86 (void) KStandardAction::open(
87 actn, SLOT( slotLoad() ), actionCollection());
88 (void) KStandardAction::saveAs(
89 actn, SLOT( slotSaveAs() ), actionCollection());
92 (void) KStandardAction::cut(actn, SLOT( slotCut() ), actionCollection());
93 (void) KStandardAction::copy(actn, SLOT( slotCopy() ), actionCollection());
94 (void) KStandardAction::paste(actn, SLOT( slotPaste() ), actionCollection());
96 // actions
97 KAction* actnDelete = actionCollection()->addAction("delete");
98 actnDelete->setIcon(KIcon("edit-delete"));
99 actnDelete->setText(i18n("&Delete"));
100 actnDelete->setShortcut(Qt::Key_Delete);
101 connect(actnDelete, SIGNAL( triggered() ), actn, SLOT( slotDelete() ));
103 KAction* actnRename = actionCollection()->addAction("rename");
104 actnRename->setIcon(KIcon("edit-rename"));
105 actnRename->setText(i18n("Rename"));
106 actnRename->setShortcut(Qt::Key_F2);
107 connect(actnRename, SIGNAL( triggered() ), actn, SLOT( slotRename() ));
109 KAction* actnChangeURL = actionCollection()->addAction("changeurl");
110 actnChangeURL->setIcon(KIcon("edit-rename"));
111 actnChangeURL->setText(i18n("C&hange URL"));
112 actnChangeURL->setShortcut(Qt::Key_F3);
113 connect(actnChangeURL, SIGNAL( triggered() ), actn, SLOT( slotChangeURL() ));
115 KAction* actnChangeComment = actionCollection()->addAction("changecomment");
116 actnChangeComment->setIcon(KIcon("edit-rename"));
117 actnChangeComment->setText(i18n("C&hange Comment"));
118 actnChangeComment->setShortcut(Qt::Key_F4);
119 connect(actnChangeComment, SIGNAL( triggered() ), actn, SLOT( slotChangeComment() ));
121 KAction* actnChangeIcon = actionCollection()->addAction("changeicon");
122 actnChangeIcon->setIcon(KIcon("preferences-desktop-icons"));
123 actnChangeIcon->setText(i18n("Chan&ge Icon..."));
124 connect(actnChangeIcon, SIGNAL( triggered() ), actn, SLOT( slotChangeIcon() ));
126 KAction* actnUpdateFavIcon = actionCollection()->addAction("updatefavicon");
127 actnUpdateFavIcon->setText(i18n("Update Favicon"));
128 connect(actnUpdateFavIcon, SIGNAL( triggered() ), actn, SLOT( slotUpdateFavIcon() ));
130 KAction* actnRecursiveSort = actionCollection()->addAction("recursivesort");
131 actnRecursiveSort->setText(i18n("Recursive Sort"));
132 connect(actnRecursiveSort, SIGNAL( triggered() ), actn, SLOT( slotRecursiveSort() ));
134 KAction* actnNewFolder = actionCollection()->addAction("newfolder");
135 actnNewFolder->setIcon(KIcon("folder-new"));
136 actnNewFolder->setText(i18n("&New Folder..."));
137 actnNewFolder->setShortcut(Qt::CTRL+Qt::Key_N);
138 connect(actnNewFolder, SIGNAL( triggered() ), actn, SLOT( slotNewFolder() ));
140 KAction* actnNewBookmark = actionCollection()->addAction("newbookmark");
141 actnNewBookmark->setIcon(KIcon("bookmark-new"));
142 actnNewBookmark->setText(i18n("&New Bookmark"));
143 connect(actnNewBookmark, SIGNAL( triggered() ), actn, SLOT( slotNewBookmark() ));
145 KAction* actnInsertSeparator = actionCollection()->addAction("insertseparator");
146 actnInsertSeparator->setText(i18n("&Insert Separator"));
147 actnInsertSeparator->setShortcut(Qt::CTRL+Qt::Key_I);
148 connect(actnInsertSeparator, SIGNAL( triggered() ), actn, SLOT( slotInsertSeparator() ));
150 KAction* actnSort = actionCollection()->addAction("sort");
151 actnSort->setText(i18n("&Sort Alphabetically"));
152 connect(actnSort, SIGNAL( triggered() ), actn, SLOT( slotSort() ));
154 KAction* actnSetAsToolbar = actionCollection()->addAction("setastoolbar");
155 actnSetAsToolbar->setIcon(KIcon("bookmark-toolbar"));
156 actnSetAsToolbar->setText(i18n("Set as T&oolbar Folder"));
157 connect(actnSetAsToolbar, SIGNAL( triggered() ), actn, SLOT( slotSetAsToolbar() ));
159 KAction* actnExpandAll = actionCollection()->addAction("expandall");
160 actnExpandAll->setText(i18n("&Expand All Folders"));
161 connect(actnExpandAll, SIGNAL( triggered() ), actn, SLOT( slotExpandAll() ));
163 KAction* actnCollapseAll = actionCollection()->addAction("collapseall");
164 actnCollapseAll->setText(i18n("Collapse &All Folders"));
165 connect(actnCollapseAll, SIGNAL( triggered() ), actn, SLOT( slotCollapseAll() ));
167 KAction* actnOpenLink = actionCollection()->addAction("openlink");
168 actnOpenLink->setIcon(KIcon("document-open"));
169 actnOpenLink->setText(i18n("&Open in Konqueror"));
170 connect(actnOpenLink, SIGNAL( triggered() ), actn, SLOT( slotOpenLink() ));
172 KAction* actnTestSelection = actionCollection()->addAction("testlink");
173 actnTestSelection->setIcon(KIcon("bookmarks"));
174 actnTestSelection->setText(i18n("Check &Status"));
175 connect(actnTestSelection, SIGNAL( triggered() ), actn, SLOT( slotTestSelection() ));
177 KAction* actnTestAll = actionCollection()->addAction("testall");
178 actnTestAll->setText(i18n("Check Status: &All"));
179 connect(actnTestAll, SIGNAL( triggered() ), actn, SLOT( slotTestAll() ));
181 KAction* actnUpdateAllFavIcons = actionCollection()->addAction("updateallfavicons");
182 actnUpdateAllFavIcons->setText(i18n("Update All &Favicons"));
183 connect(actnUpdateAllFavIcons, SIGNAL( triggered() ), actn, SLOT( slotUpdateAllFavIcons() ));
185 KAction* actnCancelAllTests = actionCollection()->addAction("canceltests");
186 actnCancelAllTests->setText(i18n("Cancel &Checks"));
187 connect(actnCancelAllTests, SIGNAL( triggered() ), actn, SLOT( slotCancelAllTests() ));
189 KAction* actnCancelFavIconUpdates = actionCollection()->addAction("cancelfaviconupdates");
190 actnCancelFavIconUpdates->setText(i18n("Cancel &Favicon Updates"));
191 connect(actnCancelFavIconUpdates, SIGNAL( triggered() ), actn, SLOT( slotCancelFavIconUpdates() ));
193 KAction* actnImportNS = actionCollection()->addAction("importNS");
194 actnImportNS->setObjectName("NS");
195 actnImportNS->setIcon(KIcon("netscape"));
196 actnImportNS->setText(i18n("Import &Netscape Bookmarks..."));
197 connect(actnImportNS, SIGNAL( triggered() ), actn, SLOT( slotImport() ));
199 KAction* actnImportOpera = actionCollection()->addAction("importOpera");
200 actnImportOpera->setObjectName("Opera");
201 actnImportOpera->setIcon(KIcon("opera"));
202 actnImportOpera->setText(i18n("Import &Opera Bookmarks..."));
203 connect(actnImportOpera, SIGNAL( triggered() ), actn, SLOT( slotImport() ));
205 KAction* actnImportCrashes = actionCollection()->addAction("importCrashes");
206 actnImportCrashes->setObjectName("Crashes");
207 actnImportCrashes->setText(i18n("Import All &Crash Sessions as Bookmarks..."));
208 connect(actnImportCrashes, SIGNAL( triggered() ), actn, SLOT( slotImport() ));
210 KAction* actnImportGaleon = actionCollection()->addAction("importGaleon");
211 actnImportGaleon->setObjectName("Galeon");
212 actnImportGaleon->setText(i18n("Import &Galeon Bookmarks..."));
213 connect(actnImportGaleon, SIGNAL( triggered() ), actn, SLOT( slotImport() ));
215 KAction* actnImportKDE2 = actionCollection()->addAction("importKDE2");
216 actnImportKDE2->setObjectName("KDE2");
217 actnImportKDE2->setIcon(KIcon("kde"));
218 actnImportKDE2->setText(i18n("Import &KDE 2 or KDE 3 Bookmarks..."));
220 connect(actnImportKDE2, SIGNAL( triggered() ), actn, SLOT( slotImport() ));
222 KAction* actnImportIE = actionCollection()->addAction("importIE");
223 actnImportIE->setObjectName("IE");
224 actnImportIE->setText(i18n("Import &Internet Explorer Bookmarks..."));
225 connect(actnImportIE, SIGNAL( triggered() ), actn, SLOT( slotImport() ));
227 KAction* actnImportMoz = actionCollection()->addAction("importMoz");
228 actnImportMoz->setObjectName("Moz");
229 actnImportMoz->setIcon(KIcon("mozilla"));
230 actnImportMoz->setText(i18n("Import &Mozilla Bookmarks..."));
231 connect(actnImportMoz, SIGNAL( triggered() ), actn, SLOT( slotImport() ));
233 KAction* actnExportNS = actionCollection()->addAction("exportNS");
234 actnExportNS->setIcon(KIcon("netscape"));
235 actnExportNS->setText(i18n("Export &Netscape Bookmarks"));
236 connect(actnExportNS, SIGNAL( triggered() ), actn, SLOT( slotExportNS() ));
238 KAction* actnExportOpera = actionCollection()->addAction("exportOpera");
239 actnExportOpera->setIcon(KIcon("opera"));
240 actnExportOpera->setText(i18n("Export &Opera Bookmarks..."));
241 connect(actnExportOpera, SIGNAL( triggered() ), actn, SLOT( slotExportOpera() ));
243 KAction* actnExportHTML = actionCollection()->addAction("exportHTML");
244 actnExportHTML->setIcon(KIcon("text-html"));
245 actnExportHTML->setText(i18n("Export &HTML Bookmarks..."));
246 connect(actnExportHTML, SIGNAL( triggered() ), actn, SLOT( slotExportHTML() ));
248 KAction* actnExportIE = actionCollection()->addAction("exportIE");
249 actnExportIE->setText(i18n("Export &Internet Explorer Bookmarks..."));
250 connect(actnExportIE, SIGNAL( triggered() ), actn, SLOT( slotExportIE() ));
252 KAction* actnExportMoz = actionCollection()->addAction("exportMoz");
253 actnExportMoz->setIcon(KIcon("mozilla"));
254 actnExportMoz->setText(i18n("Export &Mozilla Bookmarks..."));
255 connect(actnExportMoz, SIGNAL( triggered() ), actn, SLOT( slotExportMoz() ));
258 void ActionsImpl::slotLoad()
260 QString bookmarksFile
261 = KFileDialog::getOpenFileName(QString(), "*.xml", KEBApp::self());
262 if (bookmarksFile.isNull())
263 return;
264 KEBApp::self()->reset(QString(), bookmarksFile);
267 void ActionsImpl::slotSaveAs() {
268 KEBApp::self()->bkInfo()->commitChanges();
269 QString saveFilename
270 = KFileDialog::getSaveFileName(QString(), "*.xml", KEBApp::self());
271 if (!saveFilename.isEmpty())
272 CurrentMgr::self()->saveAs(saveFilename);
275 void CurrentMgr::doExport(ExportType type, const QString & _path) {
276 //it can be null when we use command line to export => there is not interface
277 if ( KEBApp::self() && KEBApp::self()->bkInfo() )
278 KEBApp::self()->bkInfo()->commitChanges();
279 QString path(_path);
280 // TODO - add a factory and make all this use the base class
281 if (type == OperaExport) {
282 if (path.isNull())
283 path = KOperaBookmarkImporterImpl().findDefaultLocation(true);
284 KOperaBookmarkExporterImpl exporter(mgr(), path);
285 exporter.write(mgr()->root());
286 return;
288 } else if (type == HTMLExport) {
289 if (path.isNull())
290 path = KFileDialog::getSaveFileName(
291 QDir::homePath(),
292 i18n("*.html|HTML Bookmark Listing"),
293 KEBApp::self() );
294 HTMLExporter exporter;
295 exporter.write(mgr()->root(), path);
296 return;
298 } else if (type == IEExport) {
299 if (path.isNull())
300 path = KIEBookmarkImporterImpl().findDefaultLocation(true);
301 KIEBookmarkExporterImpl exporter(mgr(), path);
302 exporter.write(mgr()->root());
303 return;
306 bool moz = (type == MozillaExport);
308 if (path.isNull()) {
309 if (moz) {
310 KMozillaBookmarkImporterImpl importer;
311 path = importer.findDefaultLocation(true);
313 else {
314 KNSBookmarkImporterImpl importer;
315 path = importer.findDefaultLocation(true);
319 if (!path.isEmpty()) {
320 KNSBookmarkExporterImpl exporter(mgr(), path);
321 exporter.write(mgr()->root());
325 void KEBApp::setCancelFavIconUpdatesEnabled(bool enabled) {
326 actionCollection()->action("cancelfaviconupdates")->setEnabled(enabled);
329 void KEBApp::setCancelTestsEnabled(bool enabled) {
330 actionCollection()->action("canceltests")->setEnabled(enabled);
333 void ActionsImpl::slotCut() {
334 KEBApp::self()->bkInfo()->commitChanges();
335 slotCopy();
336 DeleteManyCommand *mcmd = new DeleteManyCommand( i18n("Cut Items"), KEBApp::self()->selectedBookmarks() );
337 CmdHistory::self()->addCommand(mcmd);
341 void ActionsImpl::slotCopy()
343 KEBApp::self()->bkInfo()->commitChanges();
344 // this is not a command, because it can't be undone
345 KBookmark::List bookmarks = KEBApp::self()->selectedBookmarksExpanded();
346 QMimeData *mimeData = new QMimeData;
347 bookmarks.populateMimeData(mimeData);
348 QApplication::clipboard()->setMimeData( mimeData );
351 void ActionsImpl::slotPaste() {
352 KEBApp::self()->bkInfo()->commitChanges();
354 QString addr;
355 KBookmark bk = KEBApp::self()->firstSelected();
356 if(bk.isGroup())
357 addr = bk.address() + "/0"; //FIXME internal
358 else
359 addr = bk.address();
361 KEBMacroCommand *mcmd = CmdGen::insertMimeSource( i18n("Paste"), QApplication::clipboard()->mimeData(), addr);
362 CmdHistory::self()->didCommand(mcmd);
365 /* -------------------------------------- */
367 void ActionsImpl::slotNewFolder()
369 KEBApp::self()->bkInfo()->commitChanges();
370 bool ok;
371 QString str = KInputDialog::getText( i18n( "Create New Bookmark Folder" ),
372 i18n( "New folder:" ), QString(), &ok, KEBApp::self() );
373 if (!ok)
374 return;
376 CreateCommand *cmd = new CreateCommand(
377 KEBApp::self()->insertAddress(),
378 str, "bookmark_folder", /*open*/ true);
379 CmdHistory::self()->addCommand(cmd);
382 void ActionsImpl::slotNewBookmark()
384 KEBApp::self()->bkInfo()->commitChanges();
385 // TODO - make a setCurrentItem(Command *) which uses finaladdress interface
386 CreateCommand * cmd = new CreateCommand(
387 KEBApp::self()->insertAddress(),
388 QString(), "www", KUrl("http://"));
389 CmdHistory::self()->addCommand(cmd);
392 void ActionsImpl::slotInsertSeparator()
394 KEBApp::self()->bkInfo()->commitChanges();
395 CreateCommand * cmd = new CreateCommand(KEBApp::self()->insertAddress());
396 CmdHistory::self()->addCommand(cmd);
399 void ActionsImpl::slotImport() {
400 KEBApp::self()->bkInfo()->commitChanges();
401 qDebug() << "ActionsImpl::slotImport() where sender()->name() == "
402 << sender()->objectName() << endl;
403 ImportCommand* import
404 = ImportCommand::performImport(sender()->objectName(), KEBApp::self());
405 if (!import)
406 return;
407 CmdHistory::self()->addCommand(import);
408 //FIXME select import->groupAddress
411 // TODO - this is getting ugly and repetitive. cleanup!
413 void ActionsImpl::slotExportOpera() {
414 KEBApp::self()->bkInfo()->commitChanges();
415 CurrentMgr::self()->doExport(CurrentMgr::OperaExport); }
416 void ActionsImpl::slotExportHTML() {
417 KEBApp::self()->bkInfo()->commitChanges();
418 CurrentMgr::self()->doExport(CurrentMgr::HTMLExport); }
419 void ActionsImpl::slotExportIE() {
420 KEBApp::self()->bkInfo()->commitChanges();
421 CurrentMgr::self()->doExport(CurrentMgr::IEExport); }
422 void ActionsImpl::slotExportNS() {
423 KEBApp::self()->bkInfo()->commitChanges();
424 CurrentMgr::self()->doExport(CurrentMgr::NetscapeExport); }
425 void ActionsImpl::slotExportMoz() {
426 KEBApp::self()->bkInfo()->commitChanges();
427 CurrentMgr::self()->doExport(CurrentMgr::MozillaExport); }
429 /* -------------------------------------- */
431 void ActionsImpl::slotCancelFavIconUpdates() {
432 FavIconsItrHolder::self()->cancelAllItrs();
435 void ActionsImpl::slotCancelAllTests() {
436 TestLinkItrHolder::self()->cancelAllItrs();
439 void ActionsImpl::slotTestAll() {
440 TestLinkItrHolder::self()->insertItr(
441 new TestLinkItr(KEBApp::self()->allBookmarks()));
444 void ActionsImpl::slotUpdateAllFavIcons() {
445 FavIconsItrHolder::self()->insertItr(
446 new FavIconsItr(KEBApp::self()->allBookmarks()));
449 ActionsImpl::~ActionsImpl() {
450 delete FavIconsItrHolder::self();
451 delete TestLinkItrHolder::self();
454 /* -------------------------------------- */
456 void ActionsImpl::slotTestSelection() {
457 KEBApp::self()->bkInfo()->commitChanges();
458 TestLinkItrHolder::self()->insertItr(new TestLinkItr(KEBApp::self()->selectedBookmarksExpanded()));
461 void ActionsImpl::slotUpdateFavIcon() {
462 KEBApp::self()->bkInfo()->commitChanges();
463 FavIconsItrHolder::self()->insertItr(new FavIconsItr(KEBApp::self()->selectedBookmarksExpanded()));
466 /* -------------------------------------- */
468 class KBookmarkGroupList : private KBookmarkGroupTraverser {
469 public:
470 KBookmarkGroupList(KBookmarkManager *);
471 QList<KBookmark> getList(const KBookmarkGroup &);
472 private:
473 virtual void visit(const KBookmark &) {}
474 virtual void visitEnter(const KBookmarkGroup &);
475 virtual void visitLeave(const KBookmarkGroup &) {}
476 private:
477 KBookmarkManager *m_manager;
478 QList<KBookmark> m_list;
481 KBookmarkGroupList::KBookmarkGroupList( KBookmarkManager *manager ) {
482 m_manager = manager;
485 QList<KBookmark> KBookmarkGroupList::getList( const KBookmarkGroup &grp ) {
486 traverse(grp);
487 return m_list;
490 void KBookmarkGroupList::visitEnter(const KBookmarkGroup &grp) {
491 m_list << grp;
494 void ActionsImpl::slotRecursiveSort() {
495 KEBApp::self()->bkInfo()->commitChanges();
496 KBookmark bk = KEBApp::self()->firstSelected();
497 Q_ASSERT(bk.isGroup());
498 KEBMacroCommand *mcmd = new KEBMacroCommand(i18n("Recursive Sort"));
499 KBookmarkGroupList lister(CurrentMgr::self()->mgr());
500 QList<KBookmark> bookmarks = lister.getList(bk.toGroup());
501 bookmarks << bk.toGroup();
502 for (QList<KBookmark>::ConstIterator it = bookmarks.constBegin(); it != bookmarks.constEnd(); ++it) {
503 SortCommand *cmd = new SortCommand("", (*it).address());
504 cmd->execute();
505 mcmd->addCommand(cmd);
507 CmdHistory::self()->didCommand(mcmd);
510 void ActionsImpl::slotSort() {
511 KEBApp::self()->bkInfo()->commitChanges();
512 KBookmark bk = KEBApp::self()->firstSelected();
513 Q_ASSERT(bk.isGroup());
514 SortCommand *cmd = new SortCommand(i18n("Sort Alphabetically"), bk.address());
515 CmdHistory::self()->addCommand(cmd);
518 /* -------------------------------------- */
520 void ActionsImpl::slotDelete() {
521 KEBApp::self()->bkInfo()->commitChanges();
522 DeleteManyCommand *mcmd = new DeleteManyCommand(i18n("Delete Items"), KEBApp::self()->selectedBookmarks());
523 CmdHistory::self()->addCommand(mcmd);
526 void ActionsImpl::slotOpenLink()
528 KEBApp::self()->bkInfo()->commitChanges();
529 QList<KBookmark> bookmarks = KEBApp::self()->selectedBookmarksExpanded();
530 QList<KBookmark>::const_iterator it, end;
531 end = bookmarks.constEnd();
532 for (it = bookmarks.constBegin(); it != end; ++it) {
533 if ((*it).isGroup() || (*it).isSeparator())
534 continue;
535 (void)new KRun((*it).url(), KEBApp::self());
539 /* -------------------------------------- */
541 void ActionsImpl::slotRename() {
542 KEBApp::self()->bkInfo()->commitChanges();
543 KEBApp::self()->startEdit( KEBApp::NameColumn );
546 void ActionsImpl::slotChangeURL() {
547 KEBApp::self()->bkInfo()->commitChanges();
548 KEBApp::self()->startEdit( KEBApp::UrlColumn );
551 void ActionsImpl::slotChangeComment() {
552 KEBApp::self()->bkInfo()->commitChanges();
553 KEBApp::self()->startEdit( KEBApp::CommentColumn );
556 void ActionsImpl::slotSetAsToolbar() {
557 KEBApp::self()->bkInfo()->commitChanges();
558 KBookmark bk = KEBApp::self()->firstSelected();
559 Q_ASSERT(bk.isGroup());
560 KEBMacroCommand *mcmd = CmdGen::setAsToolbar(bk);
561 CmdHistory::self()->addCommand(mcmd);
564 void ActionsImpl::slotChangeIcon() {
565 KEBApp::self()->bkInfo()->commitChanges();
566 KBookmark bk = KEBApp::self()->firstSelected();
567 QString newIcon = KIconDialog::getIcon(KIconLoader::Small, KIconLoader::FileSystem, false, 0, false, KEBApp::self());
568 if (newIcon.isEmpty())
569 return;
570 EditCommand *cmd = new EditCommand(bk.address(), -1, newIcon);
572 CmdHistory::self()->addCommand(cmd);
575 void ActionsImpl::slotExpandAll()
577 KEBApp::self()->expandAll();
580 void ActionsImpl::slotCollapseAll()
582 KEBApp::self()->collapseAll();
585 #include "actionsimpl.moc"