[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/ksnapshot
From:       Pau Garcia i Quiles <pgquiles () elpauer ! org>
Date:       2010-11-09 20:56:50
Message-ID: 20101109205650.40173AC89E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1194774 by pgquiles:

Add full KIPI support

Remove custom KIPIAction and jobtracker, use the upload widget provided by the plugin

No longer exit when you click 'Copy'. Before aseigo's UI rework User1 was Quit, now \
it's Copy.

CCMAIL: rich@kde.org



 M  +1 -2      CMakeLists.txt  
 D             kipiaction.cpp  
 D             kipiaction.h  
 A             kipiimagecollectionselector.cpp   [License: GPL (v2+)]
 A             kipiimagecollectionselector.h   [License: GPL (v2+)]
 M  +5 -16     kipiinterface.cpp  
 M  +27 -13    ksnapshot.cpp  
 M  +0 -8      ksnapshot.h  
 D             ksnapshotjobtracker.cpp  
 D             ksnapshotjobtracker.h  


--- trunk/KDE/kdegraphics/ksnapshot/CMakeLists.txt #1194773:1194774
@@ -30,11 +30,10 @@
 
 if (KIPI_FOUND)
 set(ksnapshot_SRCS
-    kipiaction.cpp
     kipiinterface.cpp
     ksnapshotimagecollectionshared.cpp
     ksnapshotinfoshared.cpp
-    ksnapshotjobtracker.cpp
+    kipiimagecollectionselector.cpp
     ${ksnapshot_SRCS})
 endif (KIPI_FOUND)
 
--- trunk/KDE/kdegraphics/ksnapshot/kipiinterface.cpp #1194773:1194774
@@ -24,6 +24,7 @@
 #include "ksnapshotinfoshared.h"
 #include "ksnapshotimagecollectionshared.h"
 #include "ksnapshot.h"
+#include "kipiimagecollectionselector.h"
 #include <libkipi/uploadwidget.h>
 #include <libkipi/imagecollectionshared.h>
 #include <libkipi/imageinfo.h>
@@ -69,7 +70,7 @@
     return KIPI::ImageInfo(new KSnapshotInfoShared(this,url));
 }
 
-bool KIPIInterface::addImage(const KUrl&, QString& err) 
+bool KIPIInterface::addImage(const KUrl&, QString&)
 {
     return true;
 }
@@ -77,13 +78,13 @@
 {
 
 }
-void KIPIInterface::refreshImages( const KUrl::List& urls ) 
+void KIPIInterface::refreshImages( const KUrl::List& )
 {
-
+// TODO Implement?
 }
 
 KIPI::ImageCollectionSelector* KIPIInterface::imageCollectionSelector(QWidget \
                *parent) {
-    return new KIPI::ImageCollectionSelector(parent);
+    return new KIPIImageCollectionSelector(this, parent);
 }
 
 KIPI::UploadWidget* KIPIInterface::uploadWidget(QWidget *parent) {
@@ -92,16 +93,4 @@
 
 int KIPIInterface::features() const {
     return KIPI::HostAcceptNewImages;
-//    return KIPI::CollectionsHaveComments |
-//            KIPI::ImagesHasComments |
-//            KIPI::ImagesHasTime |
-//            KIPI::HostSupportsDateRanges |
-//            KIPI::HostAcceptNewImages |
-//            KIPI::ImagesHasTitlesWritable |
-//            KIPI::CollectionsHaveCategory |
-//            KIPI::CollectionsHaveCreationDate |
-//            KIPI::HostSupportsProgressBar |
-//            KIPI::HostSupportsTags |
-//            KIPI::HostSupportsRating |
-//            KIPI::HostSupportsThumbnails;
 }
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshot.cpp #1194773:1194774
@@ -72,7 +72,6 @@
 #ifdef KIPI_FOUND
 #include <libkipi/plugin.h>
 #include "kipiinterface.h"
-#include "kipiaction.h"
 #include <KAction>
 #endif
 
@@ -96,7 +95,6 @@
   : KDialog(parent), KSnapshotObject(), modified(false), savedPosition(QPoint(-1, \
-1))  {
     setCaption( "" );
-    setModal( true );
     showButtonSeparator( true );
     setButtons(Help | Apply | User1 | User2);
     setButtonGuiItem(Apply, KStandardGuiItem::saveAs());
@@ -139,8 +137,6 @@
 
 #ifdef KIPI_FOUND
     mPluginLoader = new KIPI::PluginLoader(QStringList(), new KIPIInterface(this), \
                "");
-
-    mTracker=new KSnapshotJobTracker(/*statusBar()*/ this);
 #endif
 
 #ifdef HAVE_X11_EXTENSIONS_XFIXES_H
@@ -266,8 +262,6 @@
     new QShortcut( Qt::Key_N, mainWidget->btnNew, SLOT(animateClick()) );
     new QShortcut( Qt::Key_Space, mainWidget->btnNew, SLOT(animateClick()) );
 
-    connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) );
-
     mainWidget->btnNew->setFocus();
     setInitialSize(QSize(250, 500));
 
@@ -488,15 +482,35 @@
 
 
 #ifdef KIPI_FOUND
-    // Add KIPI plugins
-    Q_FOREACH(KIPI::PluginLoader::Info* pluginInfo, mPluginLoader->pluginList()) {
-        QStringList pluginMime = \
                pluginInfo->service()->property("X-KIPI-Mimetypes").toStringList();
-        foreach(const QString& supportedPlugin, pluginMime) {
-            Q_UNUSED(supportedPlugin);
-            KipiAction* action=new KipiAction(pluginInfo, this, openMenu);
+    KIPI::PluginLoader::PluginList pluginList = mPluginLoader->pluginList();
+
+    Q_FOREACH(KIPI::PluginLoader::Info* pluginInfo, pluginList) {
+        if (!pluginInfo->shouldLoad()) {
+            continue;
+        }
+        KIPI::Plugin* plugin = pluginInfo->plugin();
+        if (!plugin) {
+            kWarning() << "Plugin from library" << pluginInfo->library() << "failed \
to load"; +            continue;
+        }
+
+        plugin->setup(this);
+
+        QList<KAction*> actions = plugin->actions();
+        QSet<KAction*> exportActions;
+        Q_FOREACH(KAction* action, actions) {
+            KIPI::Category category = plugin->category(action);
+            if(category == KIPI::ExportPlugin) {
+                exportActions << action;
+            }
+        }
+
+        Q_FOREACH(KAction* action, exportActions) {
             openMenu->addAction(action);
-            break; // If a plugin supports more than one MIME type, add the plugin \
only once, not once per MIME type  }
+
+//        FIXME: Port
+//            plugin->actionCollection()->readShortcutSettings();
     }
 #endif
 
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshot.h #1194773:1194774
@@ -35,7 +35,6 @@
 #include <kurl.h>
 #include "ksnapshotobject.h"
 #include "snapshottimer.h"
-#include "kipiaction.h"
 #include "ksnapshotimagecollectionshared.h"
 
 #include <config-ksnapshot.h>
@@ -45,7 +44,6 @@
 
 #ifdef KIPI_FOUND
 #include <libkipi/pluginloader.h>
-#include "ksnapshotjobtracker.h"
 #endif
 
 class KSnapshotServiceAction : public QAction
@@ -78,10 +76,6 @@
 
     QString url() const { return filename.url(); }
 
-#ifdef KIPI_FOUND
-    KSnapshotJobTracker* tracker() const { return mTracker; }
-#endif
-
 public slots:
     void slotGrab();
     void slotSave();
@@ -147,8 +141,6 @@
     bool includeAlpha;
 #ifdef KIPI_FOUND
     KIPI::PluginLoader* mPluginLoader;
-    KSnapshotJobTracker* mTracker;
-    friend void KipiAction::runJob();
     friend KUrl::List KSnapshotImageCollectionShared::images();
 #endif
 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic