diff options
Diffstat (limited to 'src/bookmarks')
-rw-r--r-- | src/bookmarks/bookmarkmanager.h | 5 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 10 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.cpp | 8 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/bookmarks/bookmarkmanager.h b/src/bookmarks/bookmarkmanager.h index 0de128a7..e5528a8a 100644 --- a/src/bookmarks/bookmarkmanager.h +++ b/src/bookmarks/bookmarkmanager.h @@ -126,6 +126,11 @@ public: void openFolderinTabs(const KBookmarkGroup &bm); void emitChanged(); + static inline QString bookmark_mime_type() + { + return QL1S("application/x-rekonq-bookmark"); + } + public Q_SLOTS: /** * @short Waits for signal that the group with the address has been modified by the caller. diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index fc9a32df..482e829f 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -289,7 +289,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) case QEvent::DragEnter: { QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent*>(event); - if (dragEvent->mimeData()->hasFormat("application/rekonq-bookmark") + if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type()) || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain")) { @@ -321,7 +321,7 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) case QEvent::DragMove: { QDragMoveEvent *dragEvent = static_cast<QDragMoveEvent*>(event); - if (dragEvent->mimeData()->hasFormat("application/rekonq-bookmark") + if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type()) || dragEvent->mimeData()->hasFormat("text/uri-list") || dragEvent->mimeData()->hasFormat("text/plain")) { @@ -400,9 +400,9 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event) m_checkedAction->setChecked(false); } - if (dropEvent->mimeData()->hasFormat("application/rekonq-bookmark")) + if (dropEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type())) { - QByteArray addresses = dropEvent->mimeData()->data("application/rekonq-bookmark"); + QByteArray addresses = dropEvent->mimeData()->data(BookmarkManager::bookmark_mime_type()); bookmark = rApp->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); if (bookmark.isNull()) return false; @@ -589,7 +589,7 @@ void BookmarkToolBar::startDrag() KBookmark bookmark = action->bookmark(); QByteArray address = bookmark.address().toLatin1(); - mimeData->setData("application/rekonq-bookmark", address); + mimeData->setData(BookmarkManager::bookmark_mime_type(), address); bookmark.populateMimeData(mimeData); QDrag *drag = new QDrag(toolBar()); diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index 534e9698..4df7b981 100644 --- a/src/bookmarks/bookmarkstreemodel.cpp +++ b/src/bookmarks/bookmarkstreemodel.cpp @@ -276,16 +276,16 @@ QVariant BookmarksTreeModel::data(const QModelIndex &index, int role) const QStringList BookmarksTreeModel::mimeTypes() const { - return QStringList("application/rekonq-bookmark"); + return QStringList(BookmarkManager::bookmark_mime_type()); } bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { - if (action != Qt::MoveAction || !data->hasFormat("application/rekonq-bookmark")) + if (action != Qt::MoveAction || !data->hasFormat(BookmarkManager::bookmark_mime_type())) return false; - QByteArray addresses = data->data("application/rekonq-bookmark"); + QByteArray addresses = data->data(BookmarkManager::bookmark_mime_type()); KBookmark bookmark = rApp->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); KBookmarkGroup root; @@ -323,7 +323,7 @@ QMimeData* BookmarksTreeModel::mimeData(const QModelIndexList &indexes) const QMimeData *mimeData = new QMimeData; QByteArray address = bookmarkForIndex(indexes.first()).address().toLatin1(); - mimeData->setData("application/rekonq-bookmark", address); + mimeData->setData(BookmarkManager::bookmark_mime_type(), address); bookmarkForIndex(indexes.first()).populateMimeData(mimeData); return mimeData; |