summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
authorDavid E. Narváez <david.narvaez@computer.org>2012-03-19 00:23:23 -0500
committerDavid E. Narváez <david.narvaez@computer.org>2012-03-19 00:23:23 -0500
commitd787c252f073fab19e97cf10884591053fe05aec (patch)
treecb68896e75170cb176def71c7455526d4c463f7d /src/bookmarks
parentrekonq 0.9.53 (diff)
downloadrekonq-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
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarkmanager.h5
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp10
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp8
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;