Commit 4045b455 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

port to KPToolDialog

parent c759c8eb
......@@ -7,16 +7,16 @@ SET(${PLUGIN_NAME}_PART_SRCS
KioExportWidget.cpp
KioImportWindow.cpp
KioImportWidget.cpp
)
)
KDE4_ADD_PLUGIN(${PLUGIN_NAME} ${${PLUGIN_NAME}_PART_SRCS})
TARGET_LINK_LIBRARIES(${PLUGIN_NAME}
${KDE4_KDEUI_LIBS}
${KIPI_LIBRARIES}
${KDE4_KIO_LIBRARY}
kipiplugins
)
${KDE4_KDEUI_LIBS}
${KIPI_LIBRARIES}
${KDE4_KIO_LIBRARY}
kipiplugins
)
INSTALL(TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
INSTALL(FILES ${PLUGIN_NAME}.desktop DESTINATION ${SERVICES_INSTALL_DIR})
......@@ -43,7 +43,6 @@ namespace KIPIPlugins
class KPImagesList;
}
using namespace KIPIPlugins;
namespace KIPIKioExportPlugin
......
......@@ -8,6 +8,7 @@
* location
*
* Copyright (C) 2006-2009 by Johannes Wienke <languitar at semipol dot de>
* Copyright (C) 2011-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -55,7 +56,7 @@ const QString KioExportWindow::HISTORY_URL_PROPERTY = "historyUrls";
const QString KioExportWindow::CONFIG_GROUP = "KioExport";
KioExportWindow::KioExportWindow(QWidget* const /*parent*/, Interface* const interface)
: KDialog(0), m_interface(interface)
: KPToolDialog(0), m_interface(interface)
{
if (!interface)
{
......@@ -90,26 +91,18 @@ KioExportWindow::KioExportWindow(QWidget* const /*parent*/, Interface* const int
// -- About data and help button ----------------------------------------
m_about = new KPAboutData(ki18n("Export to remote computer"),
KPAboutData* about = new KPAboutData(ki18n("Export to remote computer"),
0,
KAboutData::License_GPL,
ki18n("A Kipi plugin to export images over network using KIO-Slave"),
ki18n("(c) 2009, Johannes Wienke"));
m_about->addAuthor(ki18n("Johannes Wienke"),
ki18n("Developer and maintainer"),
"languitar at semipol dot de");
about->addAuthor(ki18n("Johannes Wienke"),
ki18n("Developer and maintainer"),
"languitar at semipol dot de");
disconnect(this, SIGNAL(helpClicked()),
this, SLOT(slotHelp()));
KHelpMenu* helpMenu = new KHelpMenu(this, m_about, false);
helpMenu->menu()->removeAction(helpMenu->menu()->actions().first());
QAction *handbook = new QAction(i18n("Handbook"), this);
connect(handbook, SIGNAL(triggered(bool)),
this, SLOT(slotHelp()));
helpMenu->menu()->insertAction(helpMenu->menu()->actions().first(), handbook);
button(Help)->setMenu(helpMenu->menu());
about->handbookEntry = QString("kioexport");
setAboutData(about);
// -- initial sync ------------------------------------------------------
......@@ -119,12 +112,6 @@ KioExportWindow::KioExportWindow(QWidget* const /*parent*/, Interface* const int
KioExportWindow::~KioExportWindow()
{
delete m_about;
}
void KioExportWindow::slotHelp()
{
KToolInvocation::invokeHelp("kioexport", "kipi-plugins");
}
void KioExportWindow::closeEvent(QCloseEvent* e)
......
......@@ -8,6 +8,7 @@
* location
*
* Copyright (C) 2006-2009 by Johannes Wienke <languitar at semipol dot de>
* Copyright (C) 2011-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -26,12 +27,12 @@
// KDE includes
#include <kdialog.h>
#include <kurl.h>
#include <kio/job.h>
// Local includes
#include "kptooldialog.h"
#include "KioExportWidget.h"
namespace KIPI
......@@ -39,11 +40,6 @@ namespace KIPI
class Interface;
}
namespace KIPIPlugins
{
class KPAboutData;
}
using namespace KIPI;
using namespace KIPIPlugins;
......@@ -54,7 +50,7 @@ namespace KIPIKioExportPlugin
* Main window of the KIOExport Plugin.
*/
class KioExportWindow: public KDialog
class KioExportWindow: public KPToolDialog
{
Q_OBJECT
......@@ -106,12 +102,7 @@ private Q_SLOTS:
* Re-enables the dialog after the job finished and displays a warning if
* something didn't work.
*/
void slotCopyingFinished(KJob *job);
/**
* Load plugin handbook.
*/
void slotHelp();
void slotCopyingFinished(KJob* job);
/**
* Handle Close button.
......@@ -152,8 +143,6 @@ private:
Interface* m_interface;
KioExportWidget* m_exportWidget;
KPAboutData* m_about;
};
} // namespace KIPIKioExportPlugin
......
......@@ -45,18 +45,18 @@
namespace KIPIKioExportPlugin
{
KioImportWidget::KioImportWidget(QWidget* parent, KIPI::Interface* interface)
: QWidget(parent)
KioImportWidget::KioImportWidget(QWidget* const parent, Interface* const interface)
: QWidget(parent)
{
// setup image list
m_imageList = new KIPIPlugins::KPImagesList(this);
m_imageList = new KPImagesList(this);
m_imageList->setAllowRAW(true);
m_imageList->listView()->setWhatsThis(i18n(
"This is the list of images to import "
"into the current album."));
// setup upload widget
m_uploadWidget = interface->uploadWidget(this);
m_uploadWidget = interface->uploadWidget(this);
// layout dialog
QVBoxLayout* layout = new QVBoxLayout(this);
......@@ -71,12 +71,12 @@ KioImportWidget::~KioImportWidget()
{
}
KIPIPlugins::KPImagesList* KioImportWidget::imagesList() const
KPImagesList* KioImportWidget::imagesList() const
{
return m_imageList;
}
KIPI::UploadWidget* KioImportWidget::uploadWidget() const
UploadWidget* KioImportWidget::uploadWidget() const
{
return m_uploadWidget;
}
......
......@@ -43,6 +43,9 @@ namespace KIPIPlugins
class KPImagesList;
}
using namespace KIPI;
using namespace KIPIPlugins;
namespace KIPIKioExportPlugin
{
......@@ -61,7 +64,7 @@ public:
* @param parent the parent widget
* @param interface kipi interface to use
*/
KioImportWidget(QWidget *parent, KIPI::Interface *interface);
KioImportWidget(QWidget* const parent, Interface* const interface);
/**
* Destructor.
......@@ -81,19 +84,19 @@ public:
*
* @return pointer to the image list
*/
KIPIPlugins::KPImagesList* imagesList() const;
KPImagesList* imagesList() const;
/**
* Returns the upload widget for specifying the target location.
*
* @return pointer to the widget
*/
KIPI::UploadWidget* uploadWidget() const;
UploadWidget* uploadWidget() const;
private:
KIPIPlugins::KPImagesList* m_imageList;
KIPI::UploadWidget* m_uploadWidget;
KPImagesList* m_imageList;
UploadWidget* m_uploadWidget;
};
} // namespace KIPIKioExportPlugin
......
......@@ -6,7 +6,8 @@
* Date : 04.10.2009
* Description : A tool for importing images via KIO
*
* Copyright (C) 2009 by Johannes Wienke <languitar at semipol dot de>
* Copyright (C) 2009 by Johannes Wienke <languitar at semipol dot de>
* Copyright (C) 2011-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -53,12 +54,12 @@
namespace KIPIKioExportPlugin
{
KioImportWindow::KioImportWindow(QWidget* /*parent*/, KIPI::Interface* interface)
: KDialog(0), m_interface(interface)
KioImportWindow::KioImportWindow(QWidget* const /*parent*/, Interface* const interface)
: KPToolDialog(0), m_interface(interface)
{
if (!interface)
{
kFatal() << "KIPI::Interface is empty";
kFatal() << "Interface is empty";
}
m_importWidget = new KioImportWidget(this, interface);
......@@ -89,26 +90,18 @@ KioImportWindow::KioImportWindow(QWidget* /*parent*/, KIPI::Interface* interface
// about data and help button
m_about = new KIPIPlugins::KPAboutData(ki18n("Import from remote computer"),
0,
KAboutData::License_GPL,
ki18n("A Kipi plugin to import images over network using KIO-Slave"),
ki18n("(c) 2009, Johannes Wienke"));
KPAboutData* about = new KPAboutData(ki18n("Import from remote computer"),
0,
KAboutData::License_GPL,
ki18n("A Kipi plugin to import images over network using KIO-Slave"),
ki18n("(c) 2009, Johannes Wienke"));
m_about->addAuthor(ki18n("Johannes Wienke"),
ki18n("Developer and maintainer"),
"languitar at semipol dot de");
about->addAuthor(ki18n("Johannes Wienke"),
ki18n("Developer and maintainer"),
"languitar at semipol dot de");
disconnect(this, SIGNAL(helpClicked()),
this, SLOT(slotHelp()));
KHelpMenu* helpMenu = new KHelpMenu(this, m_about, false);
helpMenu->menu()->removeAction(helpMenu->menu()->actions().first());
QAction *handbook = new QAction(i18n("Handbook"), this);
connect(handbook, SIGNAL(triggered(bool)),
this, SLOT(slotHelp()));
helpMenu->menu()->insertAction(helpMenu->menu()->actions().first(), handbook);
button(Help)->setMenu(helpMenu->menu());
about->handbookEntry = QString("kioexport");
setAboutData(about);
slotSourceAndTargetUpdated();
}
......@@ -133,7 +126,7 @@ void KioImportWindow::slotImport()
this, SLOT(slotCopyingFinished(KJob*)));
}
void KioImportWindow::slotCopyingDone(KIO::Job *job, const KUrl& from,
void KioImportWindow::slotCopyingDone(KIO::Job* job, const KUrl& from,
const KUrl& to, time_t mtime, bool directory, bool renamed)
{
Q_UNUSED(job);
......@@ -147,7 +140,7 @@ void KioImportWindow::slotCopyingDone(KIO::Job *job, const KUrl& from,
m_importWidget->imagesList()->removeItemByUrl(from);
}
void KioImportWindow::slotCopyingFinished(KJob *job)
void KioImportWindow::slotCopyingFinished(KJob* job)
{
Q_UNUSED(job);
......@@ -174,9 +167,4 @@ void KioImportWindow::slotSourceAndTargetUpdated()
enableButton(User1, hasUrlToImport && hasTarget);
}
void KioImportWindow::slotHelp()
{
KToolInvocation::invokeHelp("kioexport", "kipi-plugins");
}
} // namespace KIPIKioExportPlugin
......@@ -6,7 +6,8 @@
* Date : 04.10.2009
* Description : A tool for importing images via KIO
*
* Copyright (C) 2009 by Johannes Wienke <languitar at semipol dot de>
* Copyright (C) 2009 by Johannes Wienke <languitar at semipol dot de>
* Copyright (C) 2011-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -25,13 +26,13 @@
// KDE includes
#include <kdialog.h>
#include <kjob.h>
#include <kurl.h>
#include <kio/job.h>
// Local includes
#include "kptooldialog.h"
#include "KioImportWidget.h"
namespace KIPI
......@@ -39,10 +40,8 @@ namespace KIPI
class Interface;
}
namespace KIPIPlugins
{
class KPAboutData;
}
using namespace KIPI;
using namespace KIPIPlugins;
namespace KIPIKioExportPlugin
{
......@@ -50,9 +49,8 @@ namespace KIPIKioExportPlugin
/**
* Main dialog used for the kio import tool.
*/
class KioImportWindow : public KDialog
class KioImportWindow : public KPToolDialog
{
Q_OBJECT
public:
......@@ -62,7 +60,7 @@ public:
*
* @param parent parent widget
*/
KioImportWindow(QWidget *parent, KIPI::Interface *interface);
KioImportWindow(QWidget* const parent, Interface* const interface);
/**
* Destructor.
......@@ -85,27 +83,20 @@ private slots:
/**
* Removes the copied image from the image list.
*/
void slotCopyingDone(KIO::Job *job, const KUrl& from, const KUrl& to,
void slotCopyingDone(KIO::Job* job, const KUrl& from, const KUrl& to,
time_t mtime, bool directory, bool renamed);
/**
* Re-enables the dialog after the job finished and displays a warning if
* something didn't work.
*/
void slotCopyingFinished(KJob *job);
/**
* Load plugin handbook.
*/
void slotHelp();
void slotCopyingFinished(KJob* job);
private:
KIPI::Interface *m_interface;
KioImportWidget *m_importWidget;
Interface* m_interface;
KIPIPlugins::KPAboutData *m_about;
KioImportWidget* m_importWidget;
};
} // namespace KIPIKioExportPlugin
......
......@@ -90,7 +90,7 @@ void Plugin_KioExportImport::setup(QWidget* widget)
addAction(m_actionImport);
// check interface availability
Interface *interface = dynamic_cast<Interface*> (parent());
Interface* interface = dynamic_cast<Interface*>(parent());
if (!interface)
{
kError() << "Interface empty";
......@@ -104,7 +104,7 @@ void Plugin_KioExportImport::slotActivateExport()
{
kDebug() << "Starting KIO export";
Interface *interface = dynamic_cast<Interface*> (parent());
Interface* interface = dynamic_cast<Interface*>(parent());
if (!interface)
{
kError() << "Interface empty";
......@@ -131,7 +131,7 @@ void Plugin_KioExportImport::slotActivateImport()
{
kDebug() << "Starting KIO import";
Interface *interface = dynamic_cast<Interface*> (parent());
Interface* interface = dynamic_cast<Interface*>(parent());
if (!interface)
{
kError() << "Interface empty";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment