Commit 62797dee authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

remove private KPDialog container.

Create KPDialogBase class instead
set new method to pass hhandbook hanchor to KPAboutData
parent 45e057e8
......@@ -55,7 +55,7 @@ public:
ki18n("Developer"),
"anaselli at linux dot it");
handbookEntry = QString("acquireimages");
setHandbookEntry("acquireimages");
}
~ScanDialogAboutData()
......
......@@ -123,7 +123,7 @@ SlideShowConfig::SlideShowConfig(QWidget* const parent, SharedContainer* const s
about->addAuthor(ki18n( "Valerio Fuoglio" ), ki18n("Author and maintainer"),
"valerio dot fuoglio at gmail dot com");
about->handbookEntry = QString("slideshow");
about->setHandbookEntry("slideshow");
setAboutData(about);
// Slot connections
......
......@@ -110,7 +110,7 @@ CalWizard::CalWizard(Interface* const interface, QWidget* const parent)
about->addAuthor(ki18n("Renchi Raju"), ki18n("Former author and maintainer"),
"renchi dot raju at gmail dot com");
about->handbookEntry = QString("calendar");
about->setHandbookEntry("calendar");
setAboutData(about);
// ------------------------------------------
......
......@@ -16,7 +16,6 @@ SET(kipiplugins_LIB_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/tools/kpaboutdata.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tools/threads/kpactionthreadbase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tools/threads/kpweaverobserver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kptooldialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kptooldialog_p.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpbatchprogressdialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpimagedialog.cpp
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/kpwizardpage.cpp
......
......@@ -20,67 +20,82 @@
*
* ============================================================ */
#include "kptooldialog.h"
// KDE includes
#include <kdialog.h>
#include <kaction.h>
#include <khelpmenu.h>
#include <kicon.h>
#include <klocale.h>
#include <kmenu.h>
#include <kpushbutton.h>
#include <ktoolinvocation.h>
// Local includes
#include "kptooldialog.h"
#include "kptooldialog_p.h"
#include "kpaboutdata.h"
namespace KIPIPlugins
{
KPToolDialog::KPToolDialog(QWidget* const parent)
: KDialog(parent), d(new KPDialogPrivate(this))
KPDialogBase::KPDialogBase(KDialog* const dlg)
{
setButtons(Help | Ok);
m_about = 0;
m_dialog = dlg;
}
KPToolDialog::~KPToolDialog()
KPDialogBase::~KPDialogBase()
{
delete d;
delete m_about;
}
void KPToolDialog::setAboutData(KPAboutData* const about, KPushButton* const help)
void KPDialogBase::setAboutData(KPAboutData* const data, KPushButton* help)
{
d->setAboutData(about, help);
if (!data || !m_dialog) return;
if (!help) help = m_dialog->button(KDialog::Help);
if (!help) return;
m_about = data;
m_about->setHelpButton(help);
}
// -----------------------------------------------------------------------------------
KPWizardDialog::KPWizardDialog(QWidget* const parent)
: KAssistantDialog(parent), d(new KPDialogPrivate(this))
KPToolDialog::KPToolDialog(QWidget* const parent)
: KDialog(parent), KPDialogBase(this)
{
setButtons(Help | Ok);
}
KPToolDialog::~KPToolDialog()
{
}
KPWizardDialog::~KPWizardDialog()
// -----------------------------------------------------------------------------------
KPWizardDialog::KPWizardDialog(QWidget* const parent)
: KAssistantDialog(parent), KPDialogBase(this)
{
delete d;
}
void KPWizardDialog::setAboutData(KPAboutData* const about, KPushButton* const help)
KPWizardDialog::~KPWizardDialog()
{
d->setAboutData(about, help);
}
// -----------------------------------------------------------------------------------
KPPageDialog::KPPageDialog(QWidget* const parent)
: KPageDialog(parent), d(new KPDialogPrivate(this))
: KPageDialog(parent), KPDialogBase(this)
{
setButtons(Help | Ok);
}
KPPageDialog::~KPPageDialog()
{
delete d;
}
void KPPageDialog::setAboutData(KPAboutData* const about, KPushButton* const help)
{
d->setAboutData(about, help);
}
} // namespace KIPIPlugins
......@@ -37,52 +37,50 @@ namespace KIPIPlugins
{
class KPAboutData;
class KPDialogPrivate;
class KIPIPLUGINS_EXPORT KPToolDialog : public KDialog
class KIPIPLUGINS_EXPORT KPDialogBase
{
public:
KPToolDialog(QWidget* const parent=0);
~KPToolDialog();
KPDialogBase(KDialog* const dlg);
~KPDialogBase();
void setAboutData(KPAboutData* const about, KPushButton* const help=0);
void setAboutData(KPAboutData* const data, KPushButton* help=0);
private:
KPDialogPrivate* const d;
KPAboutData* m_about;
KDialog* m_dialog;
};
// -----------------------------------------------------------------------------------
class KIPIPLUGINS_EXPORT KPWizardDialog : public KAssistantDialog
class KIPIPLUGINS_EXPORT KPToolDialog : public KDialog, public KPDialogBase
{
public:
KPWizardDialog(QWidget* const parent=0);
~KPWizardDialog();
KPToolDialog(QWidget* const parent=0);
~KPToolDialog();
};
void setAboutData(KPAboutData* const about, KPushButton* const help=0);
// -----------------------------------------------------------------------------------
private:
class KIPIPLUGINS_EXPORT KPWizardDialog : public KAssistantDialog, public KPDialogBase
{
public:
KPDialogPrivate* const d;
KPWizardDialog(QWidget* const parent=0);
~KPWizardDialog();
};
// -----------------------------------------------------------------------------------
class KIPIPLUGINS_EXPORT KPPageDialog : public KPageDialog
class KIPIPLUGINS_EXPORT KPPageDialog : public KPageDialog, public KPDialogBase
{
public:
KPPageDialog(QWidget* const parent=0);
~KPPageDialog();
void setAboutData(KPAboutData* const about, KPushButton* const help=0);
private:
KPDialogPrivate* const d;
};
} // namespace KIPIPlugins
......
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
* Date : 2012-04-04
* Description : Tool dialog private
*
* Copyright (C) 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
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#include "kptooldialog_p.h"
// KDE includes
#include <kaction.h>
#include <khelpmenu.h>
#include <kicon.h>
#include <klocale.h>
#include <kmenu.h>
#include <kpushbutton.h>
#include <ktoolinvocation.h>
// Local includes
#include "kpaboutdata.h"
namespace KIPIPlugins
{
KPDialogPrivate::KPDialogPrivate(KDialog* const dlg)
{
m_about = 0;
m_dialog = dlg;
}
KPDialogPrivate::~KPDialogPrivate()
{
delete m_about;
}
void KPDialogPrivate::setAboutData(KPAboutData* const data, KPushButton* help)
{
if (!data || !m_dialog) return;
if (!help) help = m_dialog->button(KDialog::Help);
if (!help) return;
m_about = data;
m_about->setHelpButton(help);
}
} // namespace KIPIPlugins
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
* Date : 2012-04-04
* Description : Tool dialog private
*
* Copyright (C) 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
* Public License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* ============================================================ */
#ifndef KPTOOLDIALOG_PRIVATE_H
#define KPTOOLDIALOG_PRIVATE_H
// Local includes
#include "kptooldialog.h"
class KPushButton;
namespace KIPIPlugins
{
class KPDialogPrivate
{
public:
KPDialogPrivate(KDialog* const dlg);
~KPDialogPrivate();
void setAboutData(KPAboutData* const data, KPushButton* help=0);
private:
KPAboutData* m_about;
KDialog* m_dialog;
};
} // namespace KIPIPlugins
#endif /* KPTOOLDIALOG_PRIVATE_H */
......@@ -88,7 +88,12 @@ KPAboutData::KPAboutData(const KPAboutData& other)
: QObject((QObject*)(&other)),
KAboutData(other)
{
handbookEntry = other.handbookEntry;
setHandbookEntry(other.m_handbookEntry);
}
void KPAboutData::setHandbookEntry(const QString& entry)
{
m_handbookEntry = entry;
}
void KPAboutData::setHelpButton(KPushButton* const help)
......@@ -108,7 +113,7 @@ void KPAboutData::setHelpButton(KPushButton* const help)
void KPAboutData::slotHelp()
{
KToolInvocation::invokeHelp(handbookEntry, "kipi-plugins");
KToolInvocation::invokeHelp(m_handbookEntry, "kipi-plugins");
}
} // namespace KIPIPlugins
......@@ -55,15 +55,16 @@ public:
KPAboutData(const KPAboutData& other);
void setHandbookEntry(const QString& entry);
void setHelpButton(KPushButton* const help);
private Q_SLOTS:
void slotHelp();
public:
private:
QString handbookEntry;
QString m_handbookEntry;
};
} // namespace KIPIPlugins
......
......@@ -114,7 +114,7 @@ DsWindow::DsWindow(Interface* const interface, const QString& tmpFolder, QWidget
about->addAuthor(ki18n("Pau Garcia i Quiles"), ki18n("Author and maintainer"),
"pgquiles at elpauer dot org");
about->handbookEntry = QString("debianscreenshots");
about->setHandbookEntry("debianscreenshots");
setAboutData(about);
// ------------------------------------------------------------------------
......
......@@ -37,11 +37,12 @@
#include "XMP_Version.h"
using namespace KDcrawIface;
using namespace KIPIPlugins;
namespace KIPIDNGConverterPlugin
{
class DNGConverterAboutData : public KIPIPlugins::KPAboutData
class DNGConverterAboutData : public KPAboutData
{
public:
......@@ -74,10 +75,12 @@ public:
ki18n("Developer"),
"smit dot meh at gmail dot com");
handbookEntry = QString("dngconverter");
setHandbookEntry("dngconverter");
}
~DNGConverterAboutData(){}
~DNGConverterAboutData()
{
}
};
} // namespace KIPIDNGConverterPlugin
......
......@@ -27,10 +27,12 @@
#include "kpaboutdata.h"
using namespace KIPIPlugins;
namespace KIPIExpoBlendingPlugin
{
class ExpoBlendingAboutData : public KIPIPlugins::KPAboutData
class ExpoBlendingAboutData : public KPAboutData
{
public:
......@@ -49,7 +51,7 @@ public:
ki18n("Developer"),
"languitar at semipol dot de");
handbookEntry = QString("expoblending");
setHandbookEntry("expoblending");
}
~ExpoBlendingAboutData()
......
......@@ -131,7 +131,7 @@ FbWindow::FbWindow(Interface* const interface, const QString& tmpFolder,
about->addAuthor(ki18n("Luka Renko"), ki18n("Author and maintainer"),
"lure at kubuntu dot org");
about->handbookEntry = QString("facebook");
about->setHandbookEntry("facebook");
setAboutData(about);
// ------------------------------------------------------------------------
......
......@@ -27,10 +27,12 @@
#include "kpaboutdata.h"
using namespace KIPIPlugins;
namespace KIPIFlashExportPlugin
{
class FlashExportAboutData : public KIPIPlugins::KPAboutData
class FlashExportAboutData : public KPAboutData
{
public:
......@@ -44,7 +46,7 @@ public:
"(c) 2011, Veaceslav Munteanu"))
{
handbookEntry = QString("flashexport");
setHandbookEntry("flashexport");
addAuthor(ki18n("Joern Ahrens"),
ki18n("Author"),
......@@ -69,7 +71,9 @@ public:
"http://www.stegmann.dk/mikkel/porta");
}
~FlashExportAboutData(){}
~FlashExportAboutData()
{
}
};
} // namespace KIPIFlashExportPlugin
......
......@@ -153,7 +153,7 @@ FlickrWindow::FlickrWindow(Interface* const interface, const QString& tmpFolder,
about->addAuthor(ki18n("Gilles Caulier"), ki18n("Developer"),
"caulier dot gilles at gmail dot com");
about->handbookEntry = QString("flickrexport");
about->setHandbookEntry("flickrexport");
setAboutData(about);
// --------------------------------------------------------------------------
......
......@@ -221,7 +221,7 @@ GalleryWindow::GalleryWindow(Interface* const interface, QWidget* const parent,
{
d->interface = interface;
d->gallery = pGallery;
setWindowTitle( i18n("Gallery Export") );
setButtons( KDialog::Close | KDialog::User1 | KDialog::Help);
setModal(false);
......@@ -247,7 +247,7 @@ GalleryWindow::GalleryWindow(Interface* const interface, QWidget* const parent,
about->addAuthor(ki18n("Gilles Caulier"), ki18n("Developer"),
"caulier dot gilles at gmail dot com");
about->handbookEntry = QString("galleryexport");
about->setHandbookEntry("galleryexport");
setAboutData(about);
// User1 Button : to conf gallery settings
......
......@@ -416,7 +416,7 @@ GPSSyncDialog::GPSSyncDialog(Interface* const interface, QWidget* const parent)
ki18n("Developer"),
"caulier dot gilles at gmail dot com");
about->handbookEntry = QString("gpssync");
about->setHandbookEntry("gpssync");
setAboutData(about, help);
// ---------------------------------------------------------------
......
......@@ -253,7 +253,7 @@ Wizard::Wizard(QWidget* const parent, GalleryInfo* const info, Interface* const
ki18n("Former Author and Maintainer"),
"agateau@kde.org");
about->handbookEntry = QString("htmlexport");
about->setHandbookEntry("htmlexport");
setAboutData(about);
// ---------------------------------------------------------------
......
......@@ -109,7 +109,7 @@ ImageshackWindow::ImageshackWindow(Interface* const interface, QWidget* const pa
about->addAuthor(ki18n("Dodon Victor"), ki18n("Author"),
"dodonvictor at gmail dot com");
about->handbookEntry = QString("imageshackexport");
about->setHandbookEntry("imageshackexport");
setAboutData(about);
// -----------------------------------------------------------
......
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