diff options
author | David E. Narváez <david.narvaez@computer.org> | 2012-03-19 00:23:23 -0500 |
---|---|---|
committer | David E. Narváez <david.narvaez@computer.org> | 2012-03-19 00:23:23 -0500 |
commit | d787c252f073fab19e97cf10884591053fe05aec (patch) | |
tree | cb68896e75170cb176def71c7455526d4c463f7d | |
parent | rekonq 0.9.53 (diff) | |
download | rekonq-d787c252f073fab19e97cf10884591053fe05aec.tar.xz |
Change Bookmark MIME Type and Centralize
As discussed in the mailing list, this changes the MIME type to
x-rekonq-bookmark and centralizes all references to that MIME type in
one static method.
REVIEW: 104197
-rw-r--r-- | src/bookmarks/bookmarkmanager.h | 5 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 10 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.cpp | 8 | ||||
-rw-r--r-- | src/webview.cpp | 4 |
4 files changed, 16 insertions, 11 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; diff --git a/src/webview.cpp b/src/webview.cpp index 3d4d7dcf..d2e351c4 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -512,9 +512,9 @@ void WebView::mouseMoveEvent(QMouseEvent *event) void WebView::dropEvent(QDropEvent *event) { bool isEditable = page()->frameAt(event->pos())->hitTestContent(event->pos()).isContentEditable(); - if (event->mimeData()->hasFormat("application/rekonq-bookmark")) + if (event->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type())) { - QByteArray addresses = event->mimeData()->data("application/rekonq-bookmark"); + QByteArray addresses = event->mimeData()->data(BookmarkManager::bookmark_mime_type()); KBookmark bookmark = rApp->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data())); if (bookmark.isGroup()) { |