summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoann Laissus <yoann.laissus@gmail.com>2012-08-16 15:50:29 +0200
committerYoann Laissus <yoann.laissus@gmail.com>2012-08-16 15:50:29 +0200
commit8ef3b9dc3a7a1242e0d55d5d2cd1be600d0dfb03 (patch)
tree271a5145fa54b35c2dee6359c8f52ded6bc4f163
parent- Choose the correct MainView in ZoomBar::updateSlider() (diff)
downloadrekonq-8ef3b9dc3a7a1242e0d55d5d2cd1be600d0dfb03.tar.xz
BookmarkWidget: Add an entry to choose a folder with a KBookmarkDialog
-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);