File indexing completed on 2024-05-12 05:00:20
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 // Own 0008 #include "bookmark_module.h" 0009 #include "bookmark_item.h" 0010 0011 // Qt 0012 #include <QList> 0013 #include <QClipboard> 0014 #include <QCursor> 0015 #include <QGridLayout> 0016 #include <QLabel> 0017 #include <QMenu> 0018 #include <QIcon> 0019 #include <QAction> 0020 #include <QStandardPaths> 0021 0022 // KDE 0023 #include <k3bookmarkdrag.h> 0024 #include <kactioncollection.h> 0025 #include <kapplication.h> 0026 #include <kbookmark.h> 0027 #include <kbookmarkmanager.h> 0028 #include <kiconloader.h> 0029 #include <klineedit.h> 0030 #include <kmessagebox.h> 0031 #include <kstandardaction.h> 0032 #include <kparts/part.h> 0033 #include <kinputdialog.h> 0034 0035 KBookmarkManager *s_bookmarkManager = 0; 0036 0037 KonqSidebarBookmarkModule::KonqSidebarBookmarkModule(KonqSidebarTree *parentTree) 0038 : QObject(0L), KonqSidebarTreeModule(parentTree), 0039 m_topLevelItem(0L), m_ignoreOpenChange(true) 0040 { 0041 if (!s_bookmarkManager) { 0042 #if QT_VERSION_MAJOR < 6 0043 s_bookmarkManager = KBookmarkManager::userBookmarksManager(); 0044 #else 0045 const QString bookmarksFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/konqueror/bookmarks.xml"); 0046 s_manager = KBookmarkManager::managerForFile(bookmarksFile); 0047 #endif 0048 } 0049 0050 // formats handled by K3BookmarkDrag: 0051 QStringList formats; 0052 formats << "text/uri-list" << "application/x-xbel" << "text/plain"; 0053 tree()->setDropFormats(formats); 0054 0055 connect(tree(), SIGNAL(moved(Q3ListViewItem*,Q3ListViewItem*,Q3ListViewItem*)), 0056 this, SLOT(slotMoved(Q3ListViewItem*,Q3ListViewItem*,Q3ListViewItem*))); 0057 connect(tree(), SIGNAL(dropped(K3ListView*,QDropEvent*,Q3ListViewItem*,Q3ListViewItem*)), 0058 this, SLOT(slotDropped(K3ListView*,QDropEvent*,Q3ListViewItem*,Q3ListViewItem*))); 0059 0060 connect(tree(), SIGNAL(expanded(Q3ListViewItem*)), 0061 this, SLOT(slotOpenChange(Q3ListViewItem*))); 0062 connect(tree(), SIGNAL(collapsed(Q3ListViewItem*)), 0063 this, SLOT(slotOpenChange(Q3ListViewItem*))); 0064 0065 m_collection = new KActionCollection(this); 0066 QAction *action = m_collection->addAction("create_folder"); 0067 action->setIcon(QIcon::fromTheme("folder-new")); 0068 action->setText(i18n("&Create New Folder")); 0069 connect(action, SIGNAL(triggered(bool)), SLOT(slotCreateFolder())); 0070 action = m_collection->addAction("delete_folder"); 0071 action->setIcon(QIcon::fromTheme("edit-delete")); 0072 action->setText(i18n("Delete Folder")); 0073 connect(action, SIGNAL(triggered(bool)), SLOT(slotDelete())); 0074 action = m_collection->addAction("delete_bookmark"); 0075 action->setIcon(QIcon::fromTheme("edit-delete")); 0076 action->setText(i18n("Delete Bookmark")); 0077 connect(action, SIGNAL(triggered(bool)), SLOT(slotDelete())); 0078 action = m_collection->addAction("item_properties"); 0079 action->setIcon(QIcon::fromTheme("document-properties")); 0080 action->setText(i18n("Properties")); 0081 connect(action, SIGNAL(triggered(bool)), SLOT(slotProperties())); 0082 action = m_collection->addAction("open_window"); 0083 action->setIcon(QIcon::fromTheme("window-new")); 0084 action->setText(i18n("Open in New Window")); 0085 connect(action, SIGNAL(triggered(bool)), SLOT(slotOpenNewWindow())); 0086 action = m_collection->addAction("open_tab"); 0087 action->setIcon(QIcon::fromTheme("tab-new")); 0088 action->setText(i18n("Open in New Tab")); 0089 connect(action, SIGNAL(triggered(bool)), SLOT(slotOpenTab())); 0090 action = m_collection->addAction("folder_open_tabs"); 0091 action->setIcon(QIcon::fromTheme("tab-new")); 0092 action->setText(i18n("Open Folder in Tabs")); 0093 connect(action, SIGNAL(triggered(bool)), SLOT(slotOpenTab())); 0094 action = m_collection->addAction("copy_location"); 0095 action->setIcon(QIcon::fromTheme("edit-copy")); 0096 action->setText(i18n("Copy Link Address")); 0097 connect(action, SIGNAL(triggered(bool)), SLOT(slotCopyLocation())); 0098 0099 m_collection->addAction("edit_bookmarks", 0100 KStandardAction::editBookmarks(s_bookmarkManager, 0101 SLOT(slotEditBookmarks()), this)); 0102 0103 #if QT_VERSION_MAJOR < 6 0104 connect(s_bookmarkManager, SIGNAL(changed(QString,QString)), 0105 SLOT(slotBookmarksChanged(QString))); 0106 #else 0107 connect(s_bookmarkManager, SIGNAL(changed(QString)), 0108 SLOT(slotBookmarksChanged(QString))); 0109 #endif 0110 } 0111 0112 KonqSidebarBookmarkModule::~KonqSidebarBookmarkModule() 0113 { 0114 } 0115 0116 void KonqSidebarBookmarkModule::addTopLevelItem(KonqSidebarTreeTopLevelItem *item) 0117 { 0118 m_ignoreOpenChange = true; 0119 0120 m_topLevelItem = item; 0121 fillListView(); 0122 0123 m_ignoreOpenChange = false; 0124 } 0125 0126 bool KonqSidebarBookmarkModule::handleTopLevelContextMenu(KonqSidebarTreeTopLevelItem *, const QPoint &) 0127 { 0128 QMenu *menu = new QMenu; 0129 0130 menu->addAction(m_collection->action("folder_open_tabs")); 0131 menu->addSeparator(); 0132 menu->addAction(m_collection->action("create_folder")); 0133 0134 menu->addSeparator(); 0135 menu->addAction(m_collection->action("edit_bookmarks")); 0136 0137 menu->exec(QCursor::pos()); 0138 delete menu; 0139 0140 return true; 0141 } 0142 0143 void KonqSidebarBookmarkModule::showPopupMenu() 0144 { 0145 KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem *>(tree()->selectedItem()); 0146 if (!bi) { 0147 return; 0148 } 0149 0150 QMenu *menu = new QMenu; 0151 0152 if (bi->bookmark().isGroup()) { 0153 menu->addAction(m_collection->action("folder_open_tabs")); 0154 menu->addSeparator(); 0155 menu->addAction(m_collection->action("create_folder")); 0156 menu->addAction(m_collection->action("item_properties")); 0157 menu->addSeparator(); 0158 menu->addAction(m_collection->action("delete_folder")); 0159 } else { 0160 menu->addAction(m_collection->action("open_window")); 0161 menu->addAction(m_collection->action("open_tab")); 0162 menu->addAction(m_collection->action("copy_location")); 0163 menu->addSeparator(); 0164 menu->addAction(m_collection->action("create_folder")); 0165 menu->addAction(m_collection->action("item_properties")); 0166 menu->addSeparator(); 0167 menu->addAction(m_collection->action("delete_bookmark")); 0168 } 0169 0170 menu->exec(QCursor::pos()); 0171 delete menu; 0172 } 0173 0174 void KonqSidebarBookmarkModule::slotMoved(Q3ListViewItem *i, Q3ListViewItem *, Q3ListViewItem *after) 0175 { 0176 KonqSidebarBookmarkItem *item = dynamic_cast<KonqSidebarBookmarkItem *>(i); 0177 if (!item) { 0178 return; 0179 } 0180 KBookmark bookmark = item->bookmark(); 0181 0182 KBookmark afterBookmark; 0183 KonqSidebarBookmarkItem *afterItem = dynamic_cast<KonqSidebarBookmarkItem *>(after); 0184 if (afterItem) { 0185 afterBookmark = afterItem->bookmark(); 0186 } 0187 0188 KBookmarkGroup oldParentGroup = bookmark.parentGroup(); 0189 KBookmarkGroup parentGroup; 0190 // try to get the parent group (assume that the QListViewItem has been reparented by K3ListView)... 0191 // if anything goes wrong, use the root. 0192 if (item->parent()) { 0193 bool error = false; 0194 0195 KonqSidebarBookmarkItem *parent = dynamic_cast<KonqSidebarBookmarkItem *>((item->parent())); 0196 if (!parent) { 0197 error = true; 0198 } else { 0199 if (parent->bookmark().isGroup()) { 0200 parentGroup = parent->bookmark().toGroup(); 0201 } else { 0202 error = true; 0203 } 0204 } 0205 0206 if (error) { 0207 parentGroup = s_bookmarkManager->root(); 0208 } 0209 } else { 0210 // No parent! This means the user dropped it before the top level item 0211 // And K3ListView has moved the item there, we need to correct it 0212 tree()->moveItem(item, m_topLevelItem, 0L); 0213 parentGroup = s_bookmarkManager->root(); 0214 } 0215 0216 // remove the old reference. 0217 oldParentGroup.deleteBookmark(bookmark); 0218 0219 // insert the new item. 0220 parentGroup.moveBookmark(bookmark, afterBookmark); 0221 0222 // inform others about the changed groups. quite expensive, so do 0223 // our best to update them in only one emitChanged call. 0224 QString oldAddress = oldParentGroup.address(); 0225 QString newAddress = parentGroup.address(); 0226 if (oldAddress == newAddress) { 0227 s_bookmarkManager->emitChanged(parentGroup); 0228 } else { 0229 int i = 0; 0230 while (true) { 0231 QChar c1 = oldAddress[i]; 0232 QChar c2 = newAddress[i]; 0233 if (c1 == QChar::null) { 0234 // oldParentGroup is probably parent of parentGroup. 0235 s_bookmarkManager->emitChanged(oldParentGroup); 0236 break; 0237 } else if (c2 == QChar::null) { 0238 // parentGroup is probably parent of oldParentGroup. 0239 s_bookmarkManager->emitChanged(parentGroup); 0240 break; 0241 } else { 0242 if (c1 == c2) { 0243 // step to the next character. 0244 ++i; 0245 } else { 0246 // ugh... need to update both groups separately. 0247 s_bookmarkManager->emitChanged(oldParentGroup); 0248 s_bookmarkManager->emitChanged(parentGroup); 0249 break; 0250 } 0251 } 0252 } 0253 } 0254 } 0255 0256 void KonqSidebarBookmarkModule::slotDropped(K3ListView *, QDropEvent *e, Q3ListViewItem *parent, Q3ListViewItem *after) 0257 { 0258 if (!KBookmark::List::canDecode(e->mimeData())) { 0259 return; 0260 } 0261 0262 KBookmark afterBookmark; 0263 KonqSidebarBookmarkItem *afterItem = dynamic_cast<KonqSidebarBookmarkItem *>(after); 0264 if (afterItem) { 0265 afterBookmark = afterItem->bookmark(); 0266 } 0267 0268 KBookmarkGroup parentGroup; 0269 // try to get the parent group... 0270 if (after) { 0271 parentGroup = afterBookmark.parentGroup(); 0272 } else if (parent) { 0273 if (KonqSidebarBookmarkItem *p = dynamic_cast<KonqSidebarBookmarkItem *>(parent)) { 0274 if (!p) { 0275 return; 0276 } 0277 KBookmark bm = p->bookmark(); 0278 if (bm.isGroup()) { 0279 parentGroup = bm.toGroup(); 0280 } else { 0281 return; 0282 } 0283 } else if (parent == m_topLevelItem) { 0284 parentGroup = s_bookmarkManager->root(); 0285 } 0286 } else { 0287 // it's most probably the root... 0288 parentGroup = s_bookmarkManager->root(); 0289 } 0290 0291 QDomDocument parentDocument; 0292 const KBookmark::List bookmarks = KBookmark::List::fromMimeData(e->mimeData(), parentDocument); 0293 0294 // copy 0295 KBookmark::List::const_iterator it = bookmarks.constBegin(); 0296 for (; it != bookmarks.constEnd(); ++it) { 0297 // insert new item. 0298 parentGroup.moveBookmark(*it, afterBookmark); 0299 } 0300 0301 s_bookmarkManager->emitChanged(parentGroup); 0302 } 0303 0304 void KonqSidebarBookmarkModule::slotCreateFolder() 0305 { 0306 KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem *>(tree()->selectedItem()); 0307 KBookmarkGroup parentGroup; 0308 if (bi) { 0309 if (bi->bookmark().isGroup()) { 0310 parentGroup = bi->bookmark().toGroup(); 0311 } else { 0312 parentGroup = bi->bookmark().parentGroup(); 0313 } 0314 } else if (tree()->selectedItem() == m_topLevelItem) { 0315 parentGroup = s_bookmarkManager->root(); 0316 } else { 0317 return; 0318 } 0319 0320 bool ok; 0321 const QString str = KInputDialog::getText(i18nc("@title:window", "Create New Bookmark Folder"), 0322 i18n("New folder:"), QString(), &ok, tree()); 0323 if (!ok) { 0324 return; 0325 } 0326 0327 KBookmark bookmark = parentGroup.createNewFolder(str); 0328 if (bi && !(bi->bookmark().isGroup())) { 0329 parentGroup.moveBookmark(bookmark, bi->bookmark()); 0330 } 0331 s_bookmarkManager->emitChanged(parentGroup); 0332 } 0333 0334 void KonqSidebarBookmarkModule::slotDelete() 0335 { 0336 KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem *>(tree()->selectedItem()); 0337 if (!bi) { 0338 return; 0339 } 0340 0341 KBookmark bookmark = bi->bookmark(); 0342 bool folder = bookmark.isGroup(); 0343 0344 if (KMessageBox::warningTwoActions( 0345 tree(), 0346 folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bookmark.text()) 0347 : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bookmark.text()), 0348 folder ? i18nc("@title:window", "Bookmark Folder Deletion") 0349 : i18nc("@title:window", "Bookmark Deletion"), 0350 KStandardGuiItem::del(), KStandardGuiItem::cancel()) 0351 != KMessageBox::PrimaryAction 0352 ) { 0353 return; 0354 } 0355 0356 KBookmarkGroup parentBookmark = bookmark.parentGroup(); 0357 parentBookmark.deleteBookmark(bookmark); 0358 0359 s_bookmarkManager->emitChanged(parentBookmark); 0360 } 0361 0362 void makeTextNodeMod(const KBookmark &bk, const QString &m_nodename, const QString &m_newText) 0363 { 0364 QDomNode subnode = bk.internalElement().namedItem(m_nodename); 0365 if (subnode.isNull()) { 0366 subnode = bk.internalElement().ownerDocument().createElement(m_nodename); 0367 bk.internalElement().appendChild(subnode); 0368 } 0369 0370 if (subnode.firstChild().isNull()) { 0371 QDomText domtext = subnode.ownerDocument().createTextNode(""); 0372 subnode.appendChild(domtext); 0373 } 0374 0375 QDomText domtext = subnode.firstChild().toText(); 0376 0377 QString m_oldText = domtext.data(); 0378 domtext.setData(m_newText); 0379 } 0380 0381 void KonqSidebarBookmarkModule::slotProperties(KonqSidebarBookmarkItem *bi) 0382 { 0383 if (!bi) { 0384 bi = dynamic_cast<KonqSidebarBookmarkItem *>(tree()->selectedItem()); 0385 if (!bi) { 0386 return; 0387 } 0388 } 0389 0390 KBookmark bookmark = bi->bookmark(); 0391 0392 QString folder = bookmark.isGroup() ? QString() : bookmark.url().pathOrUrl(); 0393 BookmarkEditDialog dlg(bookmark.fullText(), folder, 0, 0, 0394 i18nc("@title:window", "Bookmark Properties")); 0395 if (dlg.exec() != KDialog::Accepted) { 0396 return; 0397 } 0398 0399 makeTextNodeMod(bookmark, "title", dlg.finalTitle()); 0400 if (!dlg.finalUrl().isNull()) { 0401 QUrl u(dlg.finalUrl()); 0402 bookmark.internalElement().setAttribute("href", u.url()); 0403 } 0404 0405 KBookmarkGroup parentBookmark = bookmark.parentGroup(); 0406 s_bookmarkManager->emitChanged(parentBookmark); 0407 } 0408 0409 void KonqSidebarBookmarkModule::slotOpenNewWindow() 0410 { 0411 KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem *>(tree()->selectedItem()); 0412 if (!bi) { 0413 return; 0414 } 0415 0416 KParts::OpenUrlArguments args; 0417 args.setActionRequestedByUser(true); 0418 BrowserArguments browserArgs; 0419 browserArgs.setForcesNewWindow(true); 0420 emit tree()->createNewWindow(bi->bookmark().url(), args, browserArgs); 0421 } 0422 0423 void KonqSidebarBookmarkModule::slotOpenTab() 0424 { 0425 KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem *>(tree()->selectedItem()); 0426 KBookmark bookmark; 0427 if (bi) { 0428 bookmark = bi->bookmark(); 0429 } else if (tree()->selectedItem() == m_topLevelItem) { 0430 bookmark = s_bookmarkManager->root(); 0431 } else { 0432 return; 0433 } 0434 0435 KParts::OpenUrlArguments args; 0436 args.setActionRequestedByUser(true); 0437 BrowserArguments browserArguments; 0438 browserArguments.setNewTab(true); 0439 if (bookmark.isGroup()) { 0440 KBookmarkGroup group = bookmark.toGroup(); 0441 bookmark = group.first(); 0442 while (!bookmark.isNull()) { 0443 if (!bookmark.isGroup() && !bookmark.isSeparator()) { 0444 emit tree()->createNewWindow(bookmark.url(), 0445 args, 0446 browserArguments); 0447 } 0448 bookmark = group.next(bookmark); 0449 } 0450 } else { 0451 emit tree()->createNewWindow(bookmark.url(), 0452 args, 0453 browserArguments); 0454 } 0455 } 0456 0457 void KonqSidebarBookmarkModule::slotCopyLocation() 0458 { 0459 KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem *>(tree()->selectedItem()); 0460 if (!bi) { 0461 return; 0462 } 0463 0464 KBookmark bookmark = bi->bookmark(); 0465 0466 if (!bookmark.isGroup()) { 0467 qApp->clipboard()->setData(K3BookmarkDrag::newDrag(bookmark, 0), 0468 QClipboard::Selection); 0469 qApp->clipboard()->setData(K3BookmarkDrag::newDrag(bookmark, 0), 0470 QClipboard::Clipboard); 0471 } 0472 } 0473 0474 void KonqSidebarBookmarkModule::slotOpenChange(Q3ListViewItem *i) 0475 { 0476 if (m_ignoreOpenChange) { 0477 return; 0478 } 0479 0480 KonqSidebarBookmarkItem *bi = dynamic_cast<KonqSidebarBookmarkItem *>(i); 0481 if (!bi) { 0482 return; 0483 } 0484 0485 KBookmark bookmark = bi->bookmark(); 0486 0487 bool open = bi->isOpen(); 0488 0489 if (!open) { 0490 m_folderOpenState.remove(bookmark.address()); // no need to store closed folders... 0491 } else { 0492 m_folderOpenState[bookmark.address()] = open; 0493 } 0494 } 0495 0496 void KonqSidebarBookmarkModule::slotBookmarksChanged(const QString &groupAddress) 0497 { 0498 m_ignoreOpenChange = true; 0499 0500 // update the right part of the tree 0501 KBookmarkGroup group = s_bookmarkManager->findByAddress(groupAddress).toGroup(); 0502 KonqSidebarBookmarkItem *item = findByAddress(groupAddress); 0503 Q_ASSERT(!group.isNull()); 0504 Q_ASSERT(item); 0505 if (!group.isNull() && item) { 0506 // Delete all children of item 0507 Q3ListViewItem *child = item->firstChild(); 0508 while (child) { 0509 Q3ListViewItem *next = child->nextSibling(); 0510 delete child; 0511 child = next; 0512 } 0513 fillGroup(item, group); 0514 } 0515 0516 m_ignoreOpenChange = false; 0517 } 0518 0519 void KonqSidebarBookmarkModule::fillListView() 0520 { 0521 m_ignoreOpenChange = true; 0522 0523 KBookmarkGroup root = s_bookmarkManager->root(); 0524 fillGroup(m_topLevelItem, root); 0525 0526 m_ignoreOpenChange = false; 0527 } 0528 0529 void KonqSidebarBookmarkModule::fillGroup(KonqSidebarTreeItem *parentItem, const KBookmarkGroup &group) 0530 { 0531 int n = 0; 0532 for (KBookmark bk = group.first(); !bk.isNull(); bk = group.next(bk), ++n) { 0533 KonqSidebarBookmarkItem *item = new KonqSidebarBookmarkItem(parentItem, m_topLevelItem, bk, n); 0534 if (bk.isGroup()) { 0535 KBookmarkGroup grp = bk.toGroup(); 0536 fillGroup(item, grp); 0537 0538 QString address(grp.address()); 0539 if (m_folderOpenState.contains(address)) { 0540 item->setOpen(m_folderOpenState[address]); 0541 } else { 0542 item->setOpen(false); 0543 } 0544 } else if (bk.isSeparator()) { 0545 item->setVisible(false); // ### this probably causes bug #78257 0546 } else { 0547 item->setExpandable(false); 0548 } 0549 } 0550 } 0551 0552 // Borrowed from KEditBookmarks 0553 KonqSidebarBookmarkItem *KonqSidebarBookmarkModule::findByAddress(const QString &address) const 0554 { 0555 Q3ListViewItem *item = m_topLevelItem; 0556 // The address is something like /5/10/2 0557 #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) 0558 const QStringList addresses = address.split('/', QString::SkipEmptyParts); 0559 #else 0560 const QStringList addresses = address.split('/', Qt::SkipEmptyParts); 0561 #endif 0562 for (QStringList::const_iterator it = addresses.constBegin(); it != addresses.constEnd(); ++it) { 0563 uint number = (*it).toUInt(); 0564 item = item->firstChild(); 0565 for (uint i = 0; i < number; ++i) { 0566 item = item->nextSibling(); 0567 } 0568 } 0569 Q_ASSERT(item); 0570 return static_cast<KonqSidebarBookmarkItem *>(item); 0571 } 0572 0573 // Borrowed&modified from KBookmarkMenu... 0574 BookmarkEditDialog::BookmarkEditDialog(const QString &title, const QString &url, 0575 QWidget *parent, const char *name, const QString &caption) 0576 : KDialog(parent), 0577 m_title(0), m_location(0) 0578 { 0579 setObjectName(name); 0580 setModal(true); 0581 setCaption(caption); 0582 setButtons(Ok | Cancel); 0583 0584 setButtonText(Ok, i18n("&Update")); 0585 0586 QWidget *main = new QWidget(this); 0587 setMainWidget(main); 0588 0589 bool folder = url.isNull(); 0590 QGridLayout *grid = new QGridLayout(main); 0591 0592 QLabel *nameLabel = new QLabel(i18n("Name:"), main); 0593 nameLabel->setObjectName(QLatin1String("title label")); 0594 grid->addWidget(nameLabel, 0, 0); 0595 m_title = new KLineEdit(main); 0596 m_title->setText(title); 0597 nameLabel->setBuddy(m_title); 0598 grid->addWidget(m_title, 0, 1); 0599 if (!folder) { 0600 QLabel *locationLabel = new QLabel(i18n("Location:"), main); 0601 locationLabel->setObjectName(QLatin1String("location label")); 0602 grid->addWidget(locationLabel, 1, 0); 0603 m_location = new KLineEdit(main); 0604 m_location->setText(url); 0605 locationLabel->setBuddy(m_location); 0606 grid->addWidget(m_location, 1, 1); 0607 } 0608 main->setMinimumSize(300, 0); 0609 } 0610 0611 QString BookmarkEditDialog::finalUrl() const 0612 { 0613 if (m_location != 0) { 0614 return m_location->text(); 0615 } else { 0616 return QString(); 0617 } 0618 } 0619 0620 QString BookmarkEditDialog::finalTitle() const 0621 { 0622 return m_title->text(); 0623 } 0624 0625 extern "C" 0626 { 0627 KDE_EXPORT KonqSidebarTreeModule *create_konq_sidebartree_bookmarks(KonqSidebarTree *par, const bool) 0628 { 0629 return new KonqSidebarBookmarkModule(par); 0630 } 0631 } 0632