[kde-doc-english] extragear/office/kmymoney/kmymoney
Thomas Baumgart
thb at net-bembel.de
Fri Sep 30 18:37:17 UTC 2011
SVN commit 1256519 by tbaumgart:
Added capability to select the payee source when importing OFX files. More information can be found on https://svn.reviewboard.kde.org/r/6777/
FEATURE: 271734
REVIEW: 6777
GUI:
M +10 -2 kmymoney.cpp
M +1 -1 kmymoney.h
M +14 -1 plugins/importinterface.h
M +2 -2 plugins/interfaces/kmmimportinterface.cpp
M +1 -1 plugins/interfaces/kmmimportinterface.h
M +4 -0 plugins/ofximport/CMakeLists.txt
A plugins/ofximport/importoption.ui
M +11 -1 plugins/ofximport/ofximporterplugin.cpp
--- trunk/extragear/office/kmymoney/kmymoney/kmymoney.cpp #1256518:1256519
@@ -1390,7 +1390,7 @@
}
}
-KUrl KMyMoneyApp::selectFile(const QString& /*title*/, const QString& _path, const QString& mask, KFile::Mode mode)
+KUrl KMyMoneyApp::selectFile(const QString& /*title*/, const QString& _path, const QString& mask, KFile::Mode mode, QWidget* widget)
{
KUrl url;
QString path(_path);
@@ -1400,12 +1400,20 @@
if (path.isEmpty())
path = "kfiledialog:///kmymoney-import";
- QPointer<KFileDialog> dialog = new KFileDialog(KUrl(path), mask, this);
+ QPointer<KFileDialog> dialog = new KFileDialog(KUrl(path), mask, this, widget);
dialog->setMode(mode);
if (dialog->exec() == QDialog::Accepted) {
url = dialog->selectedUrl();
}
+
+ // in case we have an additional widget, we remove it from the
+ // dialog, so that the caller can still access it. Therefore, it is
+ // the callers responsibility to delete the object
+
+ if (widget)
+ widget->setParent(0);
+
delete dialog;
return url;
--- trunk/extragear/office/kmymoney/kmymoney/kmymoney.h #1256518:1256519
@@ -527,7 +527,7 @@
*/
void setAccountOnlineParameters(const MyMoneyAccount& acc, const MyMoneyKeyValueContainer& kvps);
- KUrl selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode);
+ KUrl selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode, QWidget *widget);
const MyMoneyAccount& findAccount(const MyMoneyAccount& acc, const MyMoneyAccount& parent) const;
--- trunk/extragear/office/kmymoney/kmymoney/plugins/importinterface.h #1256518:1256519
@@ -54,7 +54,20 @@
explicit ImportInterface(QObject* parent, const char* name = 0);
~ImportInterface() {}
- virtual KUrl selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode) const = 0;
+ /**
+ * This method is provided by KMyMoney to select a file to
+ * be imported. A caption for the dialog can be provided via
+ * @a title, a specific directory to be started with as @a path.
+ * Which files are selectable is controlled via the contents
+ * of @a mask. @a mode controls the behavior of the dialog. In case
+ * the importer requires additional information, it can provide
+ * a widget to ask for them. If none are required, pass 0.
+ *
+ * @note In case you create a widget and pass it to selectFile()
+ * you are responsible to delete the widget. It will not be deleted
+ * automatically during the destruction of the dialog.
+ */
+ virtual KUrl selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode, QWidget *widget) const = 0;
signals:
};
--- trunk/extragear/office/kmymoney/kmymoney/plugins/interfaces/kmmimportinterface.cpp #1256518:1256519
@@ -34,9 +34,9 @@
{
}
-KUrl KMyMoneyPlugin::KMMImportInterface::selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode) const
+KUrl KMyMoneyPlugin::KMMImportInterface::selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode, QWidget *widget) const
{
- return m_app->selectFile(title, path, mask, mode);
+ return m_app->selectFile(title, path, mask, mode, widget);
}
#include "kmmimportinterface.moc"
--- trunk/extragear/office/kmymoney/kmymoney/plugins/interfaces/kmmimportinterface.h #1256518:1256519
@@ -52,7 +52,7 @@
KMMImportInterface(KMyMoneyApp* app, QObject* parent, const char* name = 0);
~KMMImportInterface() {}
- KUrl selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode) const;
+ KUrl selectFile(const QString& title, const QString& path, const QString& mask, KFile::Mode mode, QWidget *widget) const;
private:
KMyMoneyApp* m_app;
--- trunk/extragear/office/kmymoney/kmymoney/plugins/ofximport/CMakeLists.txt #1256518:1256519
@@ -9,6 +9,10 @@
SET(kmm_ofximport_PART_SRCS ofximporterplugin.cpp ofxpartner.cpp)
+SET(kmm_ofximport_PART_UI importoption.ui)
+
+KDE4_ADD_UI_FILES(kmm_ofximport_PART_SRCS ${kmm_ofximport_PART_UI})
+
KDE4_ADD_PLUGIN(kmm_ofximport ${kmm_ofximport_PART_SRCS})
TARGET_LINK_LIBRARIES(kmm_ofximport
--- trunk/extragear/office/kmymoney/kmymoney/plugins/ofximport/ofximporterplugin.cpp #1256518:1256519
@@ -44,6 +44,7 @@
#include "konlinebankingstatus.h"
#include "konlinebankingsetupwizard.h"
#include "kofxdirectconnectdlg.h"
+#include "ui_importoption.h"
K_PLUGIN_FACTORY(OfxImportFactory, registerPlugin<OfxImporterPlugin>();)
K_EXPORT_PLUGIN(OfxImportFactory("kmm_ofximport"))
@@ -107,10 +108,18 @@
void OfxImporterPlugin::slotImportFile(void)
{
+ QWidget * widget = new QWidget;
+ Ui_ImportOption* option = new Ui_ImportOption;
+ option->setupUi(widget);
+
KUrl url = importInterface()->selectFile(i18n("OFX import file selection"),
"",
"*.ofx *.qfx *.ofc|OFX files (*.ofx, *.qfx, *.ofc)\n*|All files",
- static_cast<KFile::Mode>((int)(KFile::File | KFile::ExistingOnly)));
+ static_cast<KFile::Mode>((int)(KFile::File | KFile::ExistingOnly)),
+ widget);
+
+ d->m_preferName = static_cast<OfxImporterPlugin::Private::NamePreference>(option->m_preferName->currentIndex());
+
if (url.isValid()) {
if (isMyFormat(url.path())) {
slotImportFile(url.path());
@@ -119,6 +128,7 @@
}
}
+ delete widget;
}
QString OfxImporterPlugin::formatName(void) const
More information about the kde-doc-english
mailing list