summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishesh Handa <me@vhanda.in>2014-08-13 11:07:44 (GMT)
committerVishesh Handa <me@vhanda.in>2014-08-13 11:07:44 (GMT)
commit46cf7e46a5c406ebe6e20c77105d5daf0ca94f5d (patch)
tree9c50f9edafff803d9e8d85b3a4d2c27443e26d3b
parent077689c4d3efec0c84c8bf85dcf4c8a4d9513d7d (diff)
Port away from KUrl::List
-rw-r--r--core/bookmarkmanager.cpp4
-rw-r--r--core/bookmarkmanager.h2
-rw-r--r--core/document.cpp4
-rw-r--r--part.cpp6
-rw-r--r--part.h4
-rw-r--r--shell/shell.cpp9
-rw-r--r--shell/shell.h2
-rw-r--r--tests/parttest.cpp2
-rw-r--r--ui/bookmarklist.cpp2
-rw-r--r--ui/sidebar.cpp6
-rw-r--r--ui/sidebar.h2
11 files changed, 23 insertions, 20 deletions
diff --git a/core/bookmarkmanager.cpp b/core/bookmarkmanager.cpp
index 47d668d..b17d2cd 100644
--- a/core/bookmarkmanager.cpp
+++ b/core/bookmarkmanager.cpp
@@ -234,9 +234,9 @@ void BookmarkManager::Private::_o_changed( const QString & groupAddress, const Q
emit q->saved();
}
-KUrl::List BookmarkManager::files() const
+QList<QUrl> BookmarkManager::files() const
{
- KUrl::List ret;
+ QList<QUrl> ret;
KBookmarkGroup group = d->manager->root();
for ( KBookmark bm = group.first(); !bm.isNull(); bm = group.next( bm ) )
{
diff --git a/core/bookmarkmanager.h b/core/bookmarkmanager.h
index f470d73..d2b7fe4 100644
--- a/core/bookmarkmanager.h
+++ b/core/bookmarkmanager.h
@@ -39,7 +39,7 @@ class OKULAR_EXPORT BookmarkManager : public QObject
/**
* Returns the list of documents with bookmarks.
*/
- KUrl::List files() const;
+ QList<QUrl> files() const;
/**
* Returns the list of bookmarks for the specified @p url.
diff --git a/core/document.cpp b/core/document.cpp
index eab4050..280ef4c 100644
--- a/core/document.cpp
+++ b/core/document.cpp
@@ -3666,8 +3666,8 @@ void Document::processAction( const Action * action )
KService::Ptr ptr = KMimeTypeTrader::self()->preferredService( mime->name(), "Application" );
if ( ptr )
{
- KUrl::List lst;
- lst.append( fileName );
+ QList<QUrl> lst;
+ lst.append( QUrl::fromLocalFile(fileName) );
KRun::run( *ptr, lst, 0 );
}
else
diff --git a/part.cpp b/part.cpp
index 94a8769..2d0dd2b 100644
--- a/part.cpp
+++ b/part.cpp
@@ -332,7 +332,7 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
m_sidebar = new Sidebar( parentWidget );
setWidget( m_sidebar );
- connect( m_sidebar, SIGNAL(urlsDropped(KUrl::List)), SLOT(handleDroppedUrls(KUrl::List)) );
+ connect( m_sidebar, SIGNAL(urlsDropped(QList<QUrl>)), SLOT(handleDroppedUrls(QList<QUrl>)) );
// build the document
m_document = new Okular::Document(widget());
@@ -989,7 +989,7 @@ void Part::openUrlFromBookmarks(const KUrl &_url)
openUrl( url );
}
-void Part::handleDroppedUrls( const KUrl::List& urls )
+void Part::handleDroppedUrls( const QList<QUrl>& urls )
{
if ( urls.isEmpty() )
return;
@@ -2042,7 +2042,7 @@ void Part::slotRenameCurrentViewportBookmark()
slotRenameBookmark( m_document->viewport() );
}
-void Part::slotAboutToShowContextMenu(KMenu * /*menu*/, QAction *action, QMenu *contextMenu)
+void Part::slotAboutToShowContextMenu(QMenu * /*menu*/, QAction *action, QMenu *contextMenu)
{
const QList<QAction*> actions = contextMenu->findChildren<QAction*>("OkularPrivateRenameBookmarkActions");
foreach(QAction *a, actions)
diff --git a/part.h b/part.h
index 7044334..2233cfc 100644
--- a/part.h
+++ b/part.h
@@ -159,7 +159,7 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
void viewerMenuStateChange(bool enabled);
void enableCloseAction(bool enable);
void mimeTypeChanged(KMimeType::Ptr mimeType);
- void urlsDropped( const KUrl::List& urls );
+ void urlsDropped( const QList<QUrl>& urls );
protected:
// reimplemented from KParts::ReadWritePart
@@ -179,7 +179,7 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
// connected to actions
void openUrlFromDocument(const KUrl &url);
void openUrlFromBookmarks(const KUrl &url);
- void handleDroppedUrls( const KUrl::List& urls );
+ void handleDroppedUrls( const QList<QUrl>& urls );
void slotGoToPage();
void slotHistoryBack();
void slotHistoryNext();
diff --git a/shell/shell.cpp b/shell/shell.cpp
index a1f826f..2edb6e1 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -50,6 +50,7 @@
#include <kicon.h>
#include <kglobal.h>
#include <kconfiggroup.h>
+#include <KUrlMimeData>
#ifdef KActivities_FOUND
#include <KActivities/ResourceInstance>
@@ -562,7 +563,7 @@ void Shell::connectPart( QObject* part )
connect( part, SIGNAL(enablePrintAction(bool)), this, SLOT(setPrintEnabled(bool)));
connect( part, SIGNAL(enableCloseAction(bool)), this, SLOT(setCloseEnabled(bool)));
connect( part, SIGNAL(mimeTypeChanged(KMimeType::Ptr)), this, SLOT(setTabIcon(KMimeType::Ptr)));
- connect( part, SIGNAL(urlsDropped(KUrl::List)), this, SLOT(handleDroppedUrls(KUrl::List)) );
+ connect( part, SIGNAL(urlsDropped(QList<QUrl>)), this, SLOT(handleDroppedUrls(QList<QUrl>)) );
}
void Shell::print()
@@ -635,7 +636,7 @@ int Shell::findTabIndex( QObject* sender )
return -1;
}
-void Shell::handleDroppedUrls( const KUrl::List& urls )
+void Shell::handleDroppedUrls( const QList<QUrl>& urls )
{
foreach( const KUrl& url, urls )
{
@@ -645,12 +646,12 @@ void Shell::handleDroppedUrls( const KUrl::List& urls )
void Shell::testTabDrop( const QDragMoveEvent* event, bool& accept )
{
- accept = KUrl::List::canDecode( event->mimeData() );
+ accept = event->mimeData()->hasUrls();
}
void Shell::handleTabDrop( QDropEvent* event )
{
- const KUrl::List list = KUrl::List::fromMimeData( event->mimeData() );
+ const QList<QUrl> list = KUrlMimeData::urlsFromMimeData( event->mimeData() );
handleDroppedUrls( list );
}
diff --git a/shell/shell.h b/shell/shell.h
index 7139bfe..8e80ffb 100644
--- a/shell/shell.h
+++ b/shell/shell.h
@@ -103,7 +103,7 @@ private slots:
void setPrintEnabled( bool enabled );
void setCloseEnabled( bool enabled );
void setTabIcon( KMimeType::Ptr mimeType );
- void handleDroppedUrls( const KUrl::List& urls );
+ void handleDroppedUrls( const QList<QUrl>& urls );
// Tab event handlers
void setActiveTab( int tab );
diff --git a/tests/parttest.cpp b/tests/parttest.cpp
index c45c1b9..dd34688 100644
--- a/tests/parttest.cpp
+++ b/tests/parttest.cpp
@@ -177,7 +177,7 @@ int main(int argc, char *argv[])
QApplication app( argc, argv );
app.setApplicationName( QLatin1String("qttest") );
qRegisterMetaType<KUrl>(); /*as done by kapplication*/
- qRegisterMetaType<KUrl::List>();
+ qRegisterMetaType<QList<QUrl>>();
Okular::PartTest test;
KGlobal::ref(); /* don't quit qeventloop after closing a mainwindow */
return QTest::qExec( &test, argc, argv );
diff --git a/ui/bookmarklist.cpp b/ui/bookmarklist.cpp
index 0121bef..0aaada7 100644
--- a/ui/bookmarklist.cpp
+++ b/ui/bookmarklist.cpp
@@ -339,7 +339,7 @@ void BookmarkList::rebuildTree( bool filter )
m_currentDocumentItem = 0;
m_tree->clear();
- KUrl::List urls = m_document->bookmarkManager()->files();
+ QList<QUrl> urls = m_document->bookmarkManager()->files();
if ( filter )
{
if ( m_document->isOpened() )
diff --git a/ui/sidebar.cpp b/ui/sidebar.cpp
index f27aa41..a30d01d 100644
--- a/ui/sidebar.cpp
+++ b/ui/sidebar.cpp
@@ -24,12 +24,14 @@
#include <qscrollbar.h>
#include <qsplitter.h>
#include <qstackedwidget.h>
+#include <qmimedata.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmenu.h>
#include <kcolorscheme.h>
+#include <kurlmimedata.h>
#include "settings.h"
@@ -756,12 +758,12 @@ void Sidebar::appearanceChanged()
void Sidebar::dragEnterEvent( QDragEnterEvent* event )
{
- event->setAccepted( KUrl::List::canDecode(event->mimeData()) );
+ event->setAccepted( event->mimeData()->hasUrls() );
}
void Sidebar::dropEvent( QDropEvent* event )
{
- const KUrl::List list = KUrl::List::fromMimeData( event->mimeData() );
+ const QList<QUrl> list = KUrlMimeData::urlsFromMimeData( event->mimeData() );
emit urlsDropped( list );
}
diff --git a/ui/sidebar.h b/ui/sidebar.h
index cf5dfc6..b56f9e9 100644
--- a/ui/sidebar.h
+++ b/ui/sidebar.h
@@ -43,7 +43,7 @@ class Sidebar : public QWidget
bool isCollapsed() const;
signals:
- void urlsDropped( const KUrl::List& urls );
+ void urlsDropped( const QList<QUrl>& urls );
protected:
void dragEnterEvent( QDragEnterEvent* event );