commit okular for openSUSE:Factory
Hello community, here is the log from the commit of package okular for openSUSE:Factory checked in at 2014-04-18 11:33:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/okular (Old) and /work/SRC/openSUSE:Factory/.okular.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "okular" Changes: -------- --- /work/SRC/openSUSE:Factory/okular/okular.changes 2014-03-30 11:41:02.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.okular.new/okular.changes 2014-04-18 12:35:35.000000000 +0200 @@ -1,0 +2,7 @@ +Fri Apr 11 16:52:21 UTC 2014 - tittiatcoke@gmail.com + +- Update to 4.13.0 + * KDE 4.13 release + * See http://www.kde.org/announcements/4.13/ + +------------------------------------------------------------------- Old: ---- okular-4.12.97.tar.xz New: ---- okular-4.13.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ okular.spec ++++++ --- /var/tmp/diff_new_pack.01WZRk/_old 2014-04-18 12:35:37.000000000 +0200 +++ /var/tmp/diff_new_pack.01WZRk/_new 2014-04-18 12:35:37.000000000 +0200 @@ -17,7 +17,7 @@ Name: okular -Version: 4.12.97 +Version: 4.13.0 Release: 0 Summary: Document Viewer License: GPL-2.0+ ++++++ okular-4.12.97.tar.xz -> okular-4.13.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/VERSION new/okular-4.13.0/VERSION --- old/okular-4.12.97/VERSION 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/VERSION 2014-04-10 00:01:39.000000000 +0200 @@ -1 +1 @@ -okular v0.18.97 +okular v0.19.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/core/utils.cpp new/okular-4.13.0/core/utils.cpp --- old/okular-4.12.97/core/utils.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/core/utils.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -76,13 +76,21 @@ double Utils::realDpiX() { const QDesktopWidget* w = QApplication::desktop(); - return (double(w->width()) * 25.4) / double(w->widthMM()); + if (w->width() > 0 && w->widthMM() > 0) { + return (double(w->width()) * 25.4) / double(w->widthMM()); + } else { + return dpiX(); + } } double Utils::realDpiY() { const QDesktopWidget* w = QApplication::desktop(); - return (double(w->height()) * 25.4) / double(w->heightMM()); + if (w->height() > 0 && w->heightMM() > 0) { + return (double(w->height()) * 25.4) / double(w->heightMM()); + } else { + return dpiY(); + } } QSizeF Utils::realDpi(QWidget* widgetOnScreen) @@ -120,18 +128,19 @@ kDebug() << "Found widget at output #" << selectedOutput->id(); QRect outputRect(selectedOutput->pos(),selectedOutput->currentMode()->size()); QSize szMM = selectedOutput->sizeMm(); - QSizeF res(static_cast<qreal>(outputRect.width())*25.4/szMM.width(), - static_cast<qreal>(outputRect.height())*25.4/szMM.height()); - kDebug() << "Output DPI is " << res; - return res; + kDebug() << "Output size is " << szMM; + if (szMM.width() > 0 && szMM.height() > 0 && outputRect.width() > 0 && outputRect.height() > 0) { + QSizeF res(static_cast<qreal>(outputRect.width())*25.4/szMM.width(), + static_cast<qreal>(outputRect.height())*25.4/szMM.height()); + kDebug() << "Output DPI is " << res; + return res; + } } #endif } // this is also fallback for LibKScreen branch if KScreen::Output // for particular widget was not found - const QDesktopWidget* desktop = QApplication::desktop(); - return QSizeF((desktop->width() * 25.4) / desktop->widthMM(), - (desktop->height() * 25.4) / desktop->heightMM()); + return QSizeF(realDpiX(), realDpiY()); } #elif defined(Q_WS_MAC) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/core/version.h new/okular-4.13.0/core/version.h --- old/okular-4.12.97/core/version.h 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/core/version.h 2014-04-10 00:01:39.000000000 +0200 @@ -10,10 +10,10 @@ #ifndef _OKULAR_VERSION_H_ #define _OKULAR_VERSION_H_ -#define OKULAR_VERSION_STRING "0.18.97" +#define OKULAR_VERSION_STRING "0.19.0" #define OKULAR_VERSION_MAJOR 0 -#define OKULAR_VERSION_MINOR 18 -#define OKULAR_VERSION_RELEASE 97 +#define OKULAR_VERSION_MINOR 19 +#define OKULAR_VERSION_RELEASE 0 #define OKULAR_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) #define OKULAR_VERSION \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/dvi/generator_dvi.cpp new/okular-4.13.0/generators/dvi/generator_dvi.cpp --- old/okular-4.12.97/generators/dvi/generator_dvi.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/dvi/generator_dvi.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -52,7 +52,7 @@ "okular_dvi", "okular_dvi", ki18n( "DVI Backend" ), - "0.3.5", + "0.3.6", ki18n( "A DVI file renderer" ), KAboutData::License_GPL, ki18n( "© 2006 Luigi Toscano" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/epub/generator_epub.cpp new/okular-4.13.0/generators/epub/generator_epub.cpp --- old/okular-4.12.97/generators/epub/generator_epub.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/epub/generator_epub.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -20,7 +20,7 @@ "okular_epub", "okular_epub", ki18n("EPub Backend"), - "0.2.2", + "0.2.3", ki18n("An EPub backend"), KAboutData::License_GPL, ki18n("© 2008 Ely Levy") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/epub/libokularGenerator_epub.desktop new/okular-4.13.0/generators/epub/libokularGenerator_epub.desktop --- old/okular-4.12.97/generators/epub/libokularGenerator_epub.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/epub/libokularGenerator_epub.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -15,7 +15,7 @@ Name[es]=Documento EPub Name[et]=EPubi dokument Name[eu]=EPub dokumentua -Name[fi]=EPub-asiakirja +Name[fi]=EPub-tiedosto Name[fr]=Document « EPub » Name[ga]=Cáipéis EPub Name[gl]=Documento EPub diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/fax/libokularGenerator_fax.desktop new/okular-4.13.0/generators/fax/libokularGenerator_fax.desktop --- old/okular-4.12.97/generators/fax/libokularGenerator_fax.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/fax/libokularGenerator_fax.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -15,7 +15,7 @@ Name[es]=Documentos de fax Name[et]=Faksidokumendid Name[eu]=Fax-dokumentuak -Name[fi]=Faksiasiakirja +Name[fi]=Faksitiedosto Name[fr]=Documents pour fax Name[ga]=Facsáil cáipéisí Name[gl]=Documentos de fax diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/fictionbook/libokularGenerator_fb.desktop new/okular-4.13.0/generators/fictionbook/libokularGenerator_fb.desktop --- old/okular-4.12.97/generators/fictionbook/libokularGenerator_fb.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/fictionbook/libokularGenerator_fb.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -16,7 +16,7 @@ Name[es]=Documento FictionBook Name[et]=FictionBooki dokument Name[eu]=Fikzio-liburu dokumentua -Name[fi]=FictionBook-asiakirja +Name[fi]=FictionBook-tiedosto Name[fr]=Document « FictionBook » Name[ga]=Cáipéis FictionBook Name[gl]=Documento FictionBook diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/mobipocket/generator_mobi.cpp new/okular-4.13.0/generators/mobipocket/generator_mobi.cpp --- old/okular-4.12.97/generators/mobipocket/generator_mobi.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/mobipocket/generator_mobi.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -19,7 +19,7 @@ "okular_mobi", "okular_mobi", ki18n("Mobipocket Backend"), - "0.1", + "0.1.1", ki18n("A mobipocket backend"), KAboutData::License_GPL, ki18n("© 2008-2009 Jakub Stachowski") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/mobipocket/libokularGenerator_mobi.desktop new/okular-4.13.0/generators/mobipocket/libokularGenerator_mobi.desktop --- old/okular-4.12.97/generators/mobipocket/libokularGenerator_mobi.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/mobipocket/libokularGenerator_mobi.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -15,7 +15,7 @@ Name[es]=Documento Mobipocket Name[et]=Mobipocketi dokument Name[eu]=Mobipocket dokumentua -Name[fi]=Mobipocket-asiakirja +Name[fi]=Mobipocket-tiedosto Name[fr]=Document « Mobipocket » Name[ga]=Cáipéis Mobipocket Name[gl]=Documento mobipocket diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/mobipocket/okularApplication_mobi.desktop new/okular-4.13.0/generators/mobipocket/okularApplication_mobi.desktop --- old/okular-4.12.97/generators/mobipocket/okularApplication_mobi.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/mobipocket/okularApplication_mobi.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -154,6 +154,7 @@ X-KDE-Keywords[nb]=mobipocket X-KDE-Keywords[nds]=Mobipocket X-KDE-Keywords[nl]=mobipocket +X-KDE-Keywords[pa]=mobipocket X-KDE-Keywords[pl]=mobipocket X-KDE-Keywords[pt]=mobipocket X-KDE-Keywords[pt_BR]=mobipocket diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/plucker/libokularGenerator_plucker.desktop new/okular-4.13.0/generators/plucker/libokularGenerator_plucker.desktop --- old/okular-4.12.97/generators/plucker/libokularGenerator_plucker.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/plucker/libokularGenerator_plucker.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -16,7 +16,7 @@ Name[es]=Documento Plucker Name[et]=Pluckeri dokument Name[eu]=Plucker dokumentua -Name[fi]=Plucker-asiakirja +Name[fi]=Plucker-tiedosto Name[fr]=Document « Plucker » Name[ga]=Cáipéis Plucker Name[gl]=Documento Plucker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/poppler/generator_pdf.cpp new/okular-4.13.0/generators/poppler/generator_pdf.cpp --- old/okular-4.12.97/generators/poppler/generator_pdf.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/poppler/generator_pdf.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -402,7 +402,7 @@ "okular_poppler", "okular_poppler", ki18n( "PDF Backend" ), - "0.6.3", + "0.6.4", ki18n( "A PDF file renderer" ), KAboutData::License_GPL, ki18n( "© 2005-2008 Albert Astals Cid" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/spectre/active-documentviewer_ghostview.desktop new/okular-4.13.0/generators/spectre/active-documentviewer_ghostview.desktop --- old/okular-4.12.97/generators/spectre/active-documentviewer_ghostview.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/spectre/active-documentviewer_ghostview.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -167,6 +167,7 @@ X-KDE-Keywords[nb]=PS, PostScript X-KDE-Keywords[nds]=PS, PostScript X-KDE-Keywords[nl]=PS, PostScript +X-KDE-Keywords[pa]=PS, ਪੋਸਟਸਕ੍ਰਿਪਟ X-KDE-Keywords[pl]=PS, PostScript X-KDE-Keywords[pt]=PS, PostScript X-KDE-Keywords[pt_BR]=PS, PostScript diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/spectre/okularApplication_ghostview.desktop new/okular-4.13.0/generators/spectre/okularApplication_ghostview.desktop --- old/okular-4.12.97/generators/spectre/okularApplication_ghostview.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/spectre/okularApplication_ghostview.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -153,6 +153,7 @@ X-KDE-Keywords[nb]=PS, PostScript X-KDE-Keywords[nds]=PS, PostScript X-KDE-Keywords[nl]=PS, PostScript +X-KDE-Keywords[pa]=PS, ਪੋਸਟਸਕ੍ਰਿਪਟ X-KDE-Keywords[pl]=PS, PostScript X-KDE-Keywords[pt]=PS, PostScript X-KDE-Keywords[pt_BR]=PS, PostScript diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/txt/active-documentviewer_txt.desktop new/okular-4.13.0/generators/txt/active-documentviewer_txt.desktop --- old/okular-4.12.97/generators/txt/active-documentviewer_txt.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/txt/active-documentviewer_txt.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -167,6 +167,7 @@ X-KDE-Keywords[nb]=txt X-KDE-Keywords[nds]=txt X-KDE-Keywords[nl]=txt +X-KDE-Keywords[pa]=txt X-KDE-Keywords[pl]=txt X-KDE-Keywords[pt]=txt X-KDE-Keywords[pt_BR]=txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/txt/libokularGenerator_txt.desktop new/okular-4.13.0/generators/txt/libokularGenerator_txt.desktop --- old/okular-4.12.97/generators/txt/libokularGenerator_txt.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/txt/libokularGenerator_txt.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -24,6 +24,7 @@ Name[nb]=tekst Name[nds]=TXT Name[nl]=tekst +Name[pa]=txt Name[pl]=txt Name[pt]=txt Name[pt_BR]=txt @@ -65,6 +66,7 @@ Comment[nb]=Txt-motor for Okular Comment[nds]=TXT-Hülpprogramm för Okular Comment[nl]=Tekst-backend voor Okular +Comment[pa]=ਓਕੁਲਾਰ ਲਈ Txt ਬੈਕਐਂਡ Comment[pl]=Obsługa Txt dla Okulara Comment[pt]=Infra-estrutura de TXT para o Okular Comment[pt_BR]=Infraestrutura Txt para o Okular diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/generators/txt/okularApplication_txt.desktop new/okular-4.13.0/generators/txt/okularApplication_txt.desktop --- old/okular-4.12.97/generators/txt/okularApplication_txt.desktop 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/generators/txt/okularApplication_txt.desktop 2014-04-10 00:01:39.000000000 +0200 @@ -154,6 +154,7 @@ X-KDE-Keywords[nb]=txt X-KDE-Keywords[nds]=txt X-KDE-Keywords[nl]=txt +X-KDE-Keywords[pa]=txt X-KDE-Keywords[pl]=txt X-KDE-Keywords[pt]=txt X-KDE-Keywords[pt_BR]=txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/part.cpp new/okular-4.13.0/part.cpp --- old/okular-4.12.97/part.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/part.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -346,6 +346,7 @@ m_sidebar = new Sidebar( parentWidget ); setWidget( m_sidebar ); + connect( m_sidebar, SIGNAL(urlsDropped(KUrl::List)), SLOT(handleDroppedUrls(KUrl::List)) ); // build the document m_document = new Okular::Document(widget()); @@ -382,7 +383,6 @@ m_searchWidget = new SearchWidget( thumbsBox, m_document ); m_thumbnailList = new ThumbnailList( thumbsBox, m_document ); // ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList ); - connect( m_thumbnailList, SIGNAL(urlDropped(KUrl)), SLOT(openUrlFromDocument(KUrl)) ); connect( m_thumbnailList, SIGNAL(rightClick(const Okular::Page*,QPoint)), this, SLOT(slotShowMenu(const Okular::Page*,QPoint)) ); tbIndex = m_sidebar->addItem( thumbsBox, KIcon( "view-preview" ), i18n("Thumbnails") ); m_sidebar->setCurrentIndex( tbIndex ); @@ -433,7 +433,6 @@ m_pageView = new PageView( rightContainer, m_document ); QMetaObject::invokeMethod( m_pageView, "setFocus", Qt::QueuedConnection ); //usability setting // m_splitter->setFocusProxy(m_pageView); - connect( m_pageView, SIGNAL(urlDropped(KUrl)), SLOT(openUrlFromDocument(KUrl))); connect( m_pageView, SIGNAL(rightClick(const Okular::Page*,QPoint)), this, SLOT(slotShowMenu(const Okular::Page*,QPoint)) ); connect( m_document, SIGNAL(error(QString,int)), m_pageView, SLOT(errorMessage(QString,int)) ); connect( m_document, SIGNAL(warning(QString,int)), m_pageView, SLOT(warningMessage(QString,int)) ); @@ -989,6 +988,20 @@ openUrl( url ); } +void Part::handleDroppedUrls( const KUrl::List& urls ) +{ + if ( urls.isEmpty() ) + return; + + if ( m_embedMode != NativeShellMode || !openNewFilesInTabs() ) + { + openUrlFromDocument( urls.first() ); + return; + } + + emit urlsDropped( urls ); +} + void Part::slotJobStarted(KIO::Job *job) { if (job) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/part.h new/okular-4.13.0/part.h --- old/okular-4.12.97/part.h 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/part.h 2014-04-10 00:01:39.000000000 +0200 @@ -158,6 +158,7 @@ void viewerMenuStateChange(bool enabled); void enableCloseAction(bool enable); void mimeTypeChanged(KMimeType::Ptr mimeType); + void urlsDropped( const KUrl::List& urls ); protected: // reimplemented from KParts::ReadWritePart @@ -176,6 +177,7 @@ // connected to actions void openUrlFromDocument(const KUrl &url); void openUrlFromBookmarks(const KUrl &url); + void handleDroppedUrls( const KUrl::List& urls ); void slotGoToPage(); void slotHistoryBack(); void slotHistoryNext(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/shell/main.cpp new/okular-4.13.0/shell/main.cpp --- old/okular-4.12.97/shell/main.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/shell/main.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -18,6 +18,7 @@ #include <klocale.h> #include <QtDBus/qdbusinterface.h> #include <QTextStream> +#include <kwindowsystem.h> #include "aboutdata.h" #include "shellutils.h" @@ -32,18 +33,89 @@ return false; if (args->isSet("print")) - iface.call("enableStartWithPrint"); + iface.call("enableStartWithPrint"); if (args->isSet("page")) iface.call("openDocument", ShellUtils::urlFromArg(args->arg(0), ShellUtils::qfileExistFunc(), args->getOption("page")).url()); else iface.call("openDocument", ShellUtils::urlFromArg(args->arg(0), ShellUtils::qfileExistFunc()).url()); - if (args->isSet("raise")){ - iface2.call("tryRaise"); + if (args->isSet("raise")) { + iface2.call("tryRaise"); } return true; } +// Ask an existing non-unique instance to open new tabs +static bool attachExistingInstance( KCmdLineArgs* args ) +{ + if ( args->count() < 1 ) + return false; + + const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); + + // Don't match the service without trailing "-" (unique instance) + const QString pattern = "org.kde.okular-"; + const QString myPid = QString::number( kapp->applicationPid() ); + QScopedPointer<QDBusInterface> bestService; + const int desktop = KWindowSystem::currentDesktop(); + + // Select the first instance that isn't us (metric may change in future) + foreach ( const QString& service, services ) + { + if ( service.startsWith(pattern) && !service.endsWith( myPid ) ) + { + bestService.reset( new QDBusInterface(service, "/okularshell", "org.kde.okular") ); + + // Find a window that can handle our documents + const QDBusReply<bool> reply = bestService->call( "canOpenDocs", args->count(), desktop ); + if( reply.isValid() && reply.value() ) + break; + + bestService.reset(); + } + } + + if ( !bestService ) + return false; + + for( int i = 0; i < args->count(); ++i ) + { + QString arg = args->arg( i ); + + // Copy stdin to temporary file which can be opened by the existing + // window. The temp file is automatically deleted after it has been + // opened. Not sure if this behavior is safe on all platforms. + QScopedPointer<QTemporaryFile> tempFile; + if( arg == "-" ) + { + tempFile.reset( new QTemporaryFile ); + QFile stdinFile; + if( !tempFile->open() || !stdinFile.open(stdin,QIODevice::ReadOnly) ) + return false; + + const size_t bufSize = 1024*1024; + QScopedPointer<char,QScopedPointerArrayDeleter<char> > buf( new char[bufSize] ); + size_t bytes; + do + { + bytes = stdinFile.read( buf.data(), bufSize ); + tempFile->write( buf.data(), bytes ); + } while( bytes != 0 ); + + arg = tempFile->fileName(); + } + + // Returns false if it can't fit another document + const QDBusReply<bool> reply = bestService->call( "openDocument", arg ); + if( !reply.isValid() || !reply.value() ) + return false; + } + + bestService->call( "tryRaise" ); + + return true; +} + int main(int argc, char** argv) { KAboutData about = okularAboutData( "okular", I18N_NOOP( "Okular" ) ); @@ -69,19 +141,14 @@ // no session.. just start up normally KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - // try to attach the "unique" session: if we succeed, do nothing more and exit - if (attachUniqueInstance(args)) + // try to attach to existing session, unique or not + if (attachUniqueInstance(args) || attachExistingInstance(args)) { args->clear(); return 0; } - if (args->count() == 0) - { - Shell* widget = new Shell(args); - widget->show(); - } - else if (args->isSet( "unique" ) && args->count() > 1) + if (args->isSet( "unique" ) && args->count() > 1) { QTextStream stream(stderr); stream << i18n( "Error: Can't open more than one document with the --unique switch" ) << endl; @@ -89,10 +156,17 @@ } else { - for (int i = 0; i < args->count(); ++i) + Shell* shell = new Shell( args ); + shell->show(); + for ( int i = 0; i < args->count(); ) { - Shell* widget = new Shell(args, i); - widget->show(); + if ( shell->openDocument( args->arg(i)) ) + ++i; + else + { + shell = new Shell( args ); + shell->show(); + } } } } @@ -100,4 +174,4 @@ return app.exec(); } -// vim:ts=2:sw=2:tw=78:et +/* kate: replace-tabs on; indent-width 4; */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/shell/shell.cpp new/okular-4.13.0/shell/shell.cpp --- old/okular-4.12.97/shell/shell.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/shell/shell.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -45,6 +45,7 @@ #include <kwindowsystem.h> #include <ktabwidget.h> #include <kxmlguifactory.h> +#include <QDragMoveEvent> #ifdef KActivities_FOUND #include <KActivities/ResourceInstance> @@ -104,6 +105,8 @@ m_tabWidget->setDocumentMode( true ); connect( m_tabWidget, SIGNAL(currentChanged(int)), SLOT(setActiveTab(int)) ); connect( m_tabWidget, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)) ); + connect( m_tabWidget, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)), SLOT(testTabDrop(const QDragMoveEvent*,bool&)) ); + connect( m_tabWidget, SIGNAL(receivedDropEvent(QDropEvent*)), SLOT(handleTabDrop(QDropEvent*)) ); setCentralWidget( m_tabWidget ); @@ -119,11 +122,6 @@ readSettings(); - if (m_args && m_args->isSet("unique") && m_args->count() == 1) - { - QDBusConnection::sessionBus().registerService("org.kde.okular"); - } - m_unique = false; if (m_args && m_args->isSet("unique") && m_args->count() <= 1) { @@ -171,6 +169,43 @@ m_args->clear(); } +// Open a new document if we have space for it +// This can hang if called on a unique instance and openUrl pops a messageBox +bool Shell::openDocument( const QString& doc ) +{ + if( m_tabs.size() <= 0 ) + return false; + + KParts::ReadWritePart* const part = m_tabs[0].part; + + // Return false if we can't open new tabs and the only part is occupied + if( !dynamic_cast<Okular::ViewerInterface*>(part)->openNewFilesInTabs() + && !part->url().isEmpty() ) + return false; + + openUrl( ShellUtils::urlFromArg(doc,ShellUtils::qfileExistFunc()) ); + + return true; +} + +bool Shell::canOpenDocs( int numDocs, int desktop ) +{ + if( m_tabs.size() <= 0 || numDocs <= 0 || m_unique ) + return false; + + KParts::ReadWritePart* const part = m_tabs[0].part; + const bool allowTabs = dynamic_cast<Okular::ViewerInterface*>(part)->openNewFilesInTabs(); + + if( !allowTabs && (numDocs > 1 || !part->url().isEmpty()) ) + return false; + + const KWindowInfo winfo( window()->effectiveWinId(), KWindowSystem::WMDesktop ); + if( winfo.desktop() != desktop ) + return false; + + return true; +} + void Shell::openUrl( const KUrl & url ) { const int activeTab = m_tabWidget->currentIndex(); @@ -382,10 +417,7 @@ void Shell::tryRaise() { - if (m_unique) - { - KWindowSystem::forceActiveWindow( window()->effectiveWinId() ); - } + KWindowSystem::forceActiveWindow( window()->effectiveWinId() ); } // only called when starting the program @@ -521,6 +553,7 @@ 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)) ); } void Shell::print() @@ -593,6 +626,25 @@ return -1; } +void Shell::handleDroppedUrls( const KUrl::List& urls ) +{ + foreach( const KUrl& url, urls ) + { + openUrl( url ); + } +} + +void Shell::testTabDrop( const QDragMoveEvent* event, bool& accept ) +{ + accept = KUrl::List::canDecode( event->mimeData() ); +} + +void Shell::handleTabDrop( QDropEvent* event ) +{ + const KUrl::List list = KUrl::List::fromMimeData( event->mimeData() ); + handleDroppedUrls( list ); +} + #include "shell.moc" /* kate: replace-tabs on; indent-width 4; */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/shell/shell.h new/okular-4.13.0/shell/shell.h --- old/okular-4.12.97/shell/shell.h 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/shell/shell.h 2014-04-10 00:01:39.000000000 +0200 @@ -63,6 +63,8 @@ void slotQuit(); Q_SCRIPTABLE Q_NOREPLY void tryRaise(); + Q_SCRIPTABLE bool openDocument( const QString& doc ); + Q_SCRIPTABLE bool canOpenDocs( int numDocs, int desktop ); protected: /** @@ -98,12 +100,15 @@ void setPrintEnabled( bool enabled ); void setCloseEnabled( bool enabled ); void setTabIcon( KMimeType::Ptr mimeType ); + void handleDroppedUrls( const KUrl::List& urls ); // Tab event handlers void setActiveTab( int tab ); void closeTab( int tab ); void activateNextTab(); void activatePrevTab(); + void testTabDrop( const QDragMoveEvent* event, bool& accept ); + void handleTabDrop( QDropEvent* event ); signals: void restoreDocument(const KConfigGroup &group); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/ui/pageview.cpp new/okular-4.13.0/ui/pageview.cpp --- old/okular-4.12.97/ui/pageview.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/ui/pageview.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -260,7 +260,7 @@ * Code weight (in rows) and meaning: * 160 - constructor and creating actions plus their connected slots (empty stuff) * 70 - DocumentObserver inherited methodes (important) - * 550 - events: mouse, keyboard, drag/drop + * 550 - events: mouse, keyboard, drag * 170 - slotRelayoutPages: set contents of the scrollview on continuous/single modes * 100 - zoom: zooming pages in different ways, keeping update the toolbar actions, etc.. * other misc functions: only slotRequestVisiblePixmaps and pickItemOnPoint noticeable, @@ -362,12 +362,11 @@ setObjectName( QLatin1String( "okular::pageView" ) ); - // viewport setup: setup focus, accept drops and track mouse + // viewport setup: setup focus, and track mouse viewport()->setFocusProxy( this ); viewport()->setFocusPolicy( Qt::StrongFocus ); viewport()->setAttribute( Qt::WA_OpaquePaintEvent ); viewport()->setAttribute( Qt::WA_NoSystemBackground ); - setAcceptDrops( true ); viewport()->setMouseTracking( true ); viewport()->setAutoFillBackground( false ); // the apparently "magic" value of 20 is the same used internally in QScrollArea @@ -3088,26 +3087,6 @@ updateCursor(); } -void PageView::dragEnterEvent( QDragEnterEvent * ev ) -{ - ev->accept(); -} - -void PageView::dragMoveEvent( QDragMoveEvent * ev ) -{ - ev->accept(); -} - -void PageView::dropEvent( QDropEvent * ev ) -{ - if ( KUrl::List::canDecode( ev->mimeData() ) ) - { - const KUrl::List list = KUrl::List::fromMimeData( ev->mimeData() ); - if ( !list.isEmpty() ) - emit urlDropped( list.first() ); - } -} - bool PageView::viewportEvent( QEvent * e ) { if ( e->type() == QEvent::ToolTip && Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Browse ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/ui/pageview.h new/okular-4.13.0/ui/pageview.h --- old/okular-4.12.97/ui/pageview.h 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/ui/pageview.h 2014-04-10 00:01:39.000000000 +0200 @@ -30,7 +30,6 @@ class KAction; class KActionCollection; class KMenu; -class KUrl; namespace Okular { class Action; @@ -136,7 +135,6 @@ void openAnnotationWindow( Okular::Annotation *annotation, int pageNumber ); signals: - void urlDropped( const KUrl& ); void rightClick( const Okular::Page *, const QPoint & ); void mouseBackButtonClick(); void mouseForwardButtonClick(); @@ -151,11 +149,6 @@ void inputMethodEvent( QInputMethodEvent * ); void wheelEvent( QWheelEvent* ); - // drag and drop related events - void dragEnterEvent( QDragEnterEvent* ); - void dragMoveEvent( QDragMoveEvent* ); - void dropEvent( QDropEvent* ); - void paintEvent( QPaintEvent *e ); void tabletEvent (QTabletEvent *e ); void mouseMoveEvent( QMouseEvent *e ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/ui/sidebar.cpp new/okular-4.13.0/ui/sidebar.cpp --- old/okular-4.12.97/ui/sidebar.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/ui/sidebar.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -449,6 +449,7 @@ mainlay->setSpacing( 0 ); setAutoFillBackground( true ); + setAcceptDrops( true ); d->list = new SidebarListWidget( this ); mainlay->addWidget( d->list ); @@ -753,4 +754,15 @@ d->sideDelegate->updateBrushCache(); } +void Sidebar::dragEnterEvent( QDragEnterEvent* event ) +{ + event->setAccepted( KUrl::List::canDecode(event->mimeData()) ); +} + +void Sidebar::dropEvent( QDropEvent* event ) +{ + const KUrl::List list = KUrl::List::fromMimeData( event->mimeData() ); + emit urlsDropped( list ); +} + #include "sidebar.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/ui/sidebar.h new/okular-4.13.0/ui/sidebar.h --- old/okular-4.12.97/ui/sidebar.h 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/ui/sidebar.h 2014-04-10 00:01:39.000000000 +0200 @@ -11,6 +11,7 @@ #define _SIDEBAR_H_ #include <qwidget.h> +#include <KUrl> class QIcon; class QListWidgetItem; @@ -41,6 +42,13 @@ void setCollapsed( bool collapsed ); bool isCollapsed() const; + signals: + void urlsDropped( const KUrl::List& urls ); + + protected: + void dragEnterEvent( QDragEnterEvent* event ); + void dropEvent( QDropEvent* event ); + private slots: void itemClicked( QListWidgetItem *item ); void splitterMoved( int pos, int index ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/ui/thumbnaillist.cpp new/okular-4.13.0/ui/thumbnaillist.cpp --- old/okular-4.12.97/ui/thumbnaillist.cpp 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/ui/thumbnaillist.cpp 2014-04-10 00:01:39.000000000 +0200 @@ -208,8 +208,6 @@ setAttribute( Qt::WA_StaticContents ); - setAcceptDrops( true ); - viewport()->setBackgroundRole( QPalette::Base ); setWidget( d ); @@ -600,21 +598,6 @@ // update Thumbnails since width has changed or height has increased delayedRequestVisiblePixmaps( 500 ); } - -void ThumbnailList::dragEnterEvent( QDragEnterEvent * ev ) -{ - ev->accept(); -} - -void ThumbnailList::dropEvent( QDropEvent * ev ) -{ - if ( KUrl::List::canDecode( ev->mimeData() ) ) - { - const KUrl::List list = KUrl::List::fromMimeData( ev->mimeData() ); - if ( !list.isEmpty() ) - emit urlDropped( list.first() ); - } -} //END widget events //BEGIN internal SLOTS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okular-4.12.97/ui/thumbnaillist.h new/okular-4.13.0/ui/thumbnaillist.h --- old/okular-4.12.97/ui/thumbnaillist.h 2014-03-26 20:35:22.000000000 +0100 +++ new/okular-4.13.0/ui/thumbnaillist.h 2014-04-10 00:01:39.000000000 +0200 @@ -17,7 +17,6 @@ #include "core/observer.h" -class KUrl; class ThumbnailListPrivate; namespace Okular { @@ -63,12 +62,7 @@ // catch the viewport event and filter them if necessary bool viewportEvent( QEvent * ); - // file drop related events (an url may be dropped even here) - void dragEnterEvent( QDragEnterEvent* ); - void dropEvent( QDropEvent* ); - signals: - void urlDropped( const KUrl& ); void rightClick( const Okular::Page *, const QPoint & ); private: -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de