Commit a81335ea authored by Maik Qualmann's avatar Maik Qualmann
Browse files

digiKam GUI export tools use a new web service starter

CCBUGS: 397972
parent 8e4c04bd
......@@ -88,118 +88,13 @@ void DigikamApp::slotMediaServer()
void DigikamApp::slotExportTool()
{
QAction* const tool = dynamic_cast<QAction*>(sender());
QAction* const action = dynamic_cast<QAction*>(sender());
int tool = actionToWebService(action);
if (tool == m_exportDropboxAction)
if (tool != WSStarter::Unknown)
{
QPointer<DBWindow> w = new DBWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
WSStarter::exportToWebService(tool, new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
}
else if (tool == m_exportOnedriveAction)
{
QPointer<ODWindow> w = new ODWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportPinterestAction)
{
QPointer<PWindow> w = new PWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportBoxAction)
{
QPointer<BOXWindow> w = new BOXWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportFacebookAction)
{
QPointer<FbWindow> w = new FbWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportFlickrAction)
{
WSStarter::exportFlickr(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
}
else if (tool == m_exportGdriveAction)
{
QPointer<GSWindow> w = new GSWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport),
this, QLatin1String("googledriveexport"));
w->exec();
delete w;
}
else if (tool == m_exportGphotoAction)
{
QPointer<GSWindow> w = new GSWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport),
this, QLatin1String("googlephotoexport"));
w->exec();
delete w;
}
else if (tool == m_exportImageshackAction)
{
QPointer<ImageShackWindow> w = new ImageShackWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportImgurAction)
{
QPointer<ImgurWindow> w = new ImgurWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportPiwigoAction)
{
QPointer<PiwigoWindow> w = new PiwigoWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportRajceAction)
{
QPointer<RajceWindow> w = new RajceWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportSmugmugAction)
{
QPointer<SmugWindow> w = new SmugWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportYandexfotkiAction)
{
QPointer<YFWindow> w = new YFWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
else if (tool == m_exportMediawikiAction)
{
QPointer<MediaWikiWindow> w = new MediaWikiWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
#ifdef HAVE_VKONTAKTE
else if (tool == m_exportVkontakteAction)
{
QPointer<VKWindow> w = new VKWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
#endif
#ifdef HAVE_KIO
else if (tool == m_exportFileTransferAction)
{
QPointer<FTExportWindow> w = new FTExportWindow(new DBInfoIface(this, QList<QUrl>(), ApplicationSettings::ImportExport), this);
w->exec();
delete w;
}
#endif
}
} // namespace Digikam
......@@ -130,27 +130,11 @@
#include "dfiledialog.h"
#include "dmediaservermngr.h"
#include "dmediaserverdlg.h"
#include "dbwindow.h"
#include "odwindow.h"
#include "pwindow.h"
#include "boxwindow.h"
#include "fbwindow.h"
#include "wsstarter.h"
#include "gswindow.h"
#include "imageshackwindow.h"
#include "imgurwindow.h"
#include "piwigowindow.h"
#include "rajcewindow.h"
#include "smugwindow.h"
#include "yfwindow.h"
#include "mediawikiwindow.h"
#ifdef HAVE_VKONTAKTE
# include "vkwindow.h"
#endif
#ifdef HAVE_KIO
# include "ftexportwindow.h"
# include "ftimportwindow.h"
#endif
......
......@@ -1267,12 +1267,14 @@ int DXmlGuiWindow::actionToWebService(QAction* const action) const
{
return WSStarter::Facebook;
}
#ifdef HAVE_KIO
else if (action == m_exportFileTransferAction)
{
return WSStarter::FileTransfer;
}
#endif
else if (action == m_exportFlickrAction)
{
return WSStarter::Flickr;
......@@ -1317,12 +1319,14 @@ int DXmlGuiWindow::actionToWebService(QAction* const action) const
{
return WSStarter::Smugmug;
}
#ifdef HAVE_VKONTAKTE
else if (action == m_exportVkontakteAction)
{
return WSStarter::Vkontakte;
}
#endif
else if (action == m_exportYandexfotkiAction)
{
return WSStarter::Yandexfotki;
......
......@@ -118,7 +118,7 @@ void ShowFoto::slotExportTool()
}
else if (tool == m_exportFlickrAction)
{
WSStarter::exportFlickr(new DMetaInfoIface(this, d->thumbBar->urls()), this);
WSStarter::exportToWebService(WSStarter::Flickr, new DMetaInfoIface(this, d->thumbBar->urls()), this);
}
else if (tool == m_exportGdriveAction)
{
......
......@@ -30,7 +30,30 @@
// Local includes
#include "digikam_debug.h"
#include "digikam_config.h"
#include "flickrwindow.h"
#include "dbwindow.h"
#include "odwindow.h"
#include "pwindow.h"
#include "boxwindow.h"
#include "fbwindow.h"
#include "gswindow.h"
#include "imageshackwindow.h"
#include "imgurwindow.h"
#include "piwigowindow.h"
#include "rajcewindow.h"
#include "smugwindow.h"
#include "yfwindow.h"
#include "mediawikiwindow.h"
#ifdef HAVE_VKONTAKTE
# include "vkwindow.h"
#endif
#ifdef HAVE_KIO
# include "ftexportwindow.h"
# include "ftimportwindow.h"
#endif
namespace Digikam
{
......@@ -43,7 +66,31 @@ public:
{
}
QPointer<FlickrWindow> flickrWindow;
QPointer<BOXWindow> boxWindow;
QPointer<DBWindow> dbWindow;
QPointer<FbWindow> fbWindow;
#ifdef HAVE_KIO
QPointer<FTExportWindow> ftExportWindow;
#endif
QPointer<FlickrWindow> flickrWindow;
QPointer<GSWindow> gdWindow;
QPointer<GSWindow> gpWindow;
QPointer<ImageShackWindow> imageShackWindow;
QPointer<ImgurWindow> imgurWindow;
QPointer<MediaWikiWindow> mediaWikiWindow;
QPointer<ODWindow> odWindow;
QPointer<PWindow> pWindow;
QPointer<PiwigoWindow> piwigoWindow;
QPointer<RajceWindow> rajceWindow;
QPointer<SmugWindow> smugWindow;
#ifdef HAVE_VKONTAKTE
QPointer<VKWindow> vkWindow;
#endif
QPointer<YFWindow> yfWindow;
};
class Q_DECL_HIDDEN WSStarterCreator
......@@ -64,12 +111,36 @@ WSStarter* WSStarter::instance()
void WSStarter::cleanUp()
{
delete instance()->d->boxWindow;
delete instance()->d->dbWindow;
delete instance()->d->fbWindow;
#ifdef HAVE_KIO
delete instance()->d->ftExportWindow;
#endif
delete instance()->d->flickrWindow;
delete instance()->d->gdWindow;
delete instance()->d->gpWindow;
delete instance()->d->imageShackWindow;
delete instance()->d->imgurWindow;
delete instance()->d->mediaWikiWindow;
delete instance()->d->odWindow;
delete instance()->d->pWindow;
delete instance()->d->piwigoWindow;
delete instance()->d->rajceWindow;
delete instance()->d->smugWindow;
#ifdef HAVE_VKONTAKTE
delete instance()->d->vkWindow;
#endif
delete instance()->d->yfWindow;
}
void WSStarter::exportFlickr(DInfoInterface* const iface, QWidget* const parent)
void WSStarter::exportToWebService(int tool, DInfoInterface* const iface, QWidget* const parent)
{
instance()->toFlickr(iface, parent);
instance()->toWebService(tool, iface, parent);
}
// ------------------------------------------------------------------------------------------------
......@@ -77,7 +148,7 @@ void WSStarter::exportFlickr(DInfoInterface* const iface, QWidget* const parent)
WSStarter::WSStarter()
: d(new Private)
{
qDebug() << "New WSStarter";
//qDebug() << "New WSStarter";
}
WSStarter::~WSStarter()
......@@ -85,19 +156,253 @@ WSStarter::~WSStarter()
delete d;
}
void WSStarter::toFlickr(DInfoInterface* const iface, QWidget* const parent)
void WSStarter::toWebService(int tool, DInfoInterface* const iface, QWidget* const parent)
{
if (d->flickrWindow && (d->flickrWindow->isMinimized() || !d->flickrWindow->isHidden()))
if (tool == Box)
{
if (d->boxWindow && (d->boxWindow->isMinimized() || !d->boxWindow->isHidden()))
{
d->boxWindow->showNormal(); // krazy:exclude=qmethods
d->boxWindow->activateWindow();
d->boxWindow->raise();
}
else
{
d->boxWindow = new BOXWindow(iface, parent);
d->boxWindow->show();
}
}
else if (tool == Dropbox)
{
if (d->dbWindow && (d->dbWindow->isMinimized() || !d->dbWindow->isHidden()))
{
d->dbWindow->showNormal(); // krazy:exclude=qmethods
d->dbWindow->activateWindow();
d->dbWindow->raise();
}
else
{
d->dbWindow = new DBWindow(iface, parent);
d->dbWindow->show();
}
}
else if (tool == Facebook)
{
if (d->fbWindow && (d->fbWindow->isMinimized() || !d->fbWindow->isHidden()))
{
d->fbWindow->showNormal(); // krazy:exclude=qmethods
d->fbWindow->activateWindow();
d->fbWindow->raise();
}
else
{
d->fbWindow = new FbWindow(iface, parent);
d->fbWindow->show();
}
}
#ifdef HAVE_KIO
else if (tool == FileTransfer)
{
if (d->ftExportWindow && (d->ftExportWindow->isMinimized() || !d->ftExportWindow->isHidden()))
{
d->ftExportWindow->showNormal(); // krazy:exclude=qmethods
d->ftExportWindow->activateWindow();
d->ftExportWindow->raise();
}
else
{
d->ftExportWindow = new FTExportWindow(iface, parent);
d->ftExportWindow->show();
}
}
#endif
else if (tool == Flickr)
{
if (d->flickrWindow && (d->flickrWindow->isMinimized() || !d->flickrWindow->isHidden()))
{
d->flickrWindow->showNormal(); // krazy:exclude=qmethods
d->flickrWindow->activateWindow();
d->flickrWindow->raise();
}
else
{
d->flickrWindow = new FlickrWindow(iface, parent);
d->flickrWindow->show();
}
}
else if (tool == Gdrive)
{
d->flickrWindow->showNormal(); // krazy:exclude=qmethods
d->flickrWindow->activateWindow();
d->flickrWindow->raise();
if (d->gdWindow && (d->gdWindow->isMinimized() || !d->gdWindow->isHidden()))
{
d->gdWindow->showNormal(); // krazy:exclude=qmethods
d->gdWindow->activateWindow();
d->gdWindow->raise();
}
else
{
d->gdWindow = new GSWindow(iface, parent, QLatin1String("googledriveexport"));
d->gdWindow->show();
}
}
else
else if (tool == Gphoto)
{
if (d->gpWindow && (d->gpWindow->isMinimized() || !d->gpWindow->isHidden()))
{
d->gpWindow->showNormal(); // krazy:exclude=qmethods
d->gpWindow->activateWindow();
d->gpWindow->raise();
}
else
{
d->gpWindow = new GSWindow(iface, parent, QLatin1String("googlephotoexport"));
d->gpWindow->show();
}
}
else if (tool == Imageshack)
{
if (d->imageShackWindow && (d->imageShackWindow->isMinimized() || !d->imageShackWindow->isHidden()))
{
d->imageShackWindow->showNormal(); // krazy:exclude=qmethods
d->imageShackWindow->activateWindow();
d->imageShackWindow->raise();
}
else
{
d->imageShackWindow = new ImageShackWindow(iface, parent);
d->imageShackWindow->show();
}
}
else if (tool == Imgur)
{
if (d->imgurWindow && (d->imgurWindow->isMinimized() || !d->imgurWindow->isHidden()))
{
d->imgurWindow->showNormal(); // krazy:exclude=qmethods
d->imgurWindow->activateWindow();
d->imgurWindow->raise();
}
else
{
d->imgurWindow = new ImgurWindow(iface, parent);
d->imgurWindow->show();
}
}
else if (tool == Mediawiki)
{
if (d->mediaWikiWindow && (d->mediaWikiWindow->isMinimized() || !d->mediaWikiWindow->isHidden()))
{
d->mediaWikiWindow->showNormal(); // krazy:exclude=qmethods
d->mediaWikiWindow->activateWindow();
d->mediaWikiWindow->raise();
}
else
{
d->mediaWikiWindow = new MediaWikiWindow(iface, parent);
d->mediaWikiWindow->show();
}
}
else if (tool == Onedrive)
{
if (d->odWindow && (d->odWindow->isMinimized() || !d->odWindow->isHidden()))
{
d->odWindow->showNormal(); // krazy:exclude=qmethods
d->odWindow->activateWindow();
d->odWindow->raise();
}
else
{
d->odWindow = new ODWindow(iface, parent);
d->odWindow->show();
}
}
else if (tool == Pinterest)
{
if (d->pWindow && (d->pWindow->isMinimized() || !d->pWindow->isHidden()))
{
d->pWindow->showNormal(); // krazy:exclude=qmethods
d->pWindow->activateWindow();
d->pWindow->raise();
}
else
{
d->pWindow = new PWindow(iface, parent);
d->pWindow->show();
}
}
else if (tool == Piwigo)
{
if (d->piwigoWindow && (d->piwigoWindow->isMinimized() || !d->piwigoWindow->isHidden()))
{
d->piwigoWindow->showNormal(); // krazy:exclude=qmethods
d->piwigoWindow->activateWindow();
d->piwigoWindow->raise();
}
else
{
d->piwigoWindow = new PiwigoWindow(iface, parent);
d->piwigoWindow->show();
}
}
else if (tool == Rajce)
{
if (d->rajceWindow && (d->rajceWindow->isMinimized() || !d->rajceWindow->isHidden()))
{
d->rajceWindow->showNormal(); // krazy:exclude=qmethods
d->rajceWindow->activateWindow();
d->rajceWindow->raise();
}
else
{
d->rajceWindow = new RajceWindow(iface, parent);
d->rajceWindow->show();
}
}
else if (tool == Smugmug)
{
if (d->smugWindow && (d->smugWindow->isMinimized() || !d->smugWindow->isHidden()))
{
d->smugWindow->showNormal(); // krazy:exclude=qmethods
d->smugWindow->activateWindow();
d->smugWindow->raise();
}
else
{
d->smugWindow = new SmugWindow(iface, parent);
d->smugWindow->show();
}
}
#ifdef HAVE_VKONTAKTE
else if (tool == Vkontakte)
{
if (d->vkWindow && (d->vkWindow->isMinimized() || !d->vkWindow->isHidden()))
{
d->vkWindow->showNormal(); // krazy:exclude=qmethods
d->vkWindow->activateWindow();
d->vkWindow->raise();
}
else
{
d->vkWindow = new VKWindow(iface, parent);
d->vkWindow->show();
}
}
#endif
else if (tool == Yandexfotki)
{
qDebug() << "New FlickrWindow";
d->flickrWindow = new FlickrWindow(iface, parent);
d->flickrWindow->show();
if (d->yfWindow && (d->yfWindow->isMinimized() || !d->yfWindow->isHidden()))
{
d->yfWindow->showNormal(); // krazy:exclude=qmethods
d->yfWindow->activateWindow();
d->yfWindow->raise();
}
else
{
d->yfWindow = new YFWindow(iface, parent);
d->yfWindow->show();
}
}
}
......
......@@ -71,14 +71,14 @@ public:
static void cleanUp();
static void exportFlickr(DInfoInterface* const iface, QWidget* const parent);
static void exportToWebService(int tool, DInfoInterface* const iface, QWidget* const parent);
private:
explicit WSStarter();
~WSStarter();
void toFlickr(DInfoInterface* const iface, QWidget* const parent);
void toWebService(int tool, DInfoInterface* const iface, QWidget* const parent);
private:
......
......@@ -129,7 +129,7 @@ void ImageWindow::slotExportTool()
}
else if (tool == m_exportFlickrAction)
{
WSStarter::exportFlickr(new DBInfoIface(this, d->thumbBar->allUrls(),
WSStarter::exportToWebService(WSStarter::Flickr, new DBInfoIface(this, d->thumbBar->allUrls(),
ApplicationSettings::ImportExport), this);