summaryrefslogtreecommitdiff
path: root/src/urlbar
diff options
context:
space:
mode:
Diffstat (limited to 'src/urlbar')
-rw-r--r--src/urlbar/bookmarkwidget.cpp22
-rw-r--r--src/urlbar/bookmarkwidget.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
index 2a91f333..4a099cf6 100644
--- a/src/urlbar/bookmarkwidget.cpp
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -41,6 +41,7 @@
#include <KIcon>
#include <KLineEdit>
#include <KRatingWidget>
+#include <KBookmarkDialog>
// Qt Includes
#include <QDialogButtonBox>
@@ -106,6 +107,7 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
m_folder = new KComboBox(this);
layout->addRow(folderLabel, m_folder);
setupFolderComboBox();
+ connect(m_folder, SIGNAL(currentIndexChanged(int)), this, SLOT(onFolderIndexChanged(int)));
// Bookmark name
QLabel *nameLabel = new QLabel(this);
@@ -276,11 +278,31 @@ void BookmarkWidget::setupFolderComboBox()
}
}
+ m_folder->insertSeparator(m_folder->count());
+ m_folder->addItem(KIcon("folder"), i18n("Choose..."));
+
int index = m_folder->findData(m_bookmark->parentGroup().address());
m_folder->setCurrentIndex(index);
}
+void BookmarkWidget::onFolderIndexChanged(int index)
+{
+ if (index == m_folder->count() - 1)
+ {
+ KBookmarkDialog dialog(rApp->bookmarkManager()->manager());
+ KBookmarkGroup selectedGroup = dialog.selectFolder(m_bookmark->parentGroup());
+
+ if (selectedGroup.address() != m_bookmark->parentGroup().address() && !selectedGroup.isNull() )
+ {
+ m_bookmark->parentGroup().deleteBookmark(*m_bookmark);
+ selectedGroup.addBookmark(*m_bookmark);
+ rApp->bookmarkManager()->manager()->emitChanged();
+ }
+ }
+}
+
+
void BookmarkWidget::removeBookmark()
{
rApp->bookmarkManager()->owner()->deleteBookmark(*m_bookmark);
diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h
index e5f25d37..7e2bb404 100644
--- a/src/urlbar/bookmarkwidget.h
+++ b/src/urlbar/bookmarkwidget.h
@@ -77,6 +77,7 @@ private:
private Q_SLOTS:
void accept();
void removeBookmark();
+ void onFolderIndexChanged(int index);
#ifdef HAVE_NEPOMUK
void setRatingSlot(int rate);