From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmymoney2/dialogs/kchooseimportexportdlg.cpp | 108 +++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 kmymoney2/dialogs/kchooseimportexportdlg.cpp (limited to 'kmymoney2/dialogs/kchooseimportexportdlg.cpp') diff --git a/kmymoney2/dialogs/kchooseimportexportdlg.cpp b/kmymoney2/dialogs/kchooseimportexportdlg.cpp new file mode 100644 index 0000000..0c390a8 --- /dev/null +++ b/kmymoney2/dialogs/kchooseimportexportdlg.cpp @@ -0,0 +1,108 @@ +/*************************************************************************** + kchooseimportexportdlg.cpp - description + ------------------- + begin : Thu Jul 12 2001 + copyright : (C) 2000-2001 by Michael Edwardes + email : mte@users.sourceforge.net + Javier Campos Morales + Felix Rodriguez + John C + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include +#include +#if QT_VERSION > 300 +#include +#else +#include +#endif + +#include + +#include +#include +#include + +#include +#include +#include + +#include "kchooseimportexportdlg.h" + +KChooseImportExportDlg::KChooseImportExportDlg(int type, QWidget *parent, const char *name ) + : KChooseImportExportDlgDecl(parent,name, true) +{ + QString filename; + + if (type==0) { // import + topLabel->setText(i18n("Please choose the type of import you wish to perform. A simple explanation\n" + "of the import type is available at the bottom of the screen and is updated when\n" + "you select an item from the choice box." + "\n\nOnce you have chosen an import type please press the OK button." )); + promptLabel->setText(i18n("Choose import type:")); + setCaption(i18n("Choose Import Type Dialog")); + } else { // export + topLabel->setText(i18n("Please choose the type of export you wish to perform. A simple explanation\n" + "of the export type is available at the bottom of the screen and is updated when\n" + "you select an item from the choice box." + "\n\nOnce you have chosen an export type please press the OK button." )); + promptLabel->setText(i18n("Choose export type:")); + setCaption(i18n("Choose Export Type Dialog")); + } + + readConfig(); + slotTypeActivated(m_lastType); + typeCombo->setCurrentItem(((m_lastType=="QIF") ? 0 : 1)); + + connect(typeCombo, SIGNAL(activated(const QString&)), this, SLOT(slotTypeActivated(const QString&))); + connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); + connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); +} + +KChooseImportExportDlg::~KChooseImportExportDlg() +{ + writeConfig(); +} + +void KChooseImportExportDlg::slotTypeActivated(const QString& text) +{ + if (text=="QIF") { + descriptionLabel->setText(i18n("QIF files are created by the popular accounting program Quicken.\n" + "Another dialog will appear, if you choose this type, asking for further\n" + "information relevant to the Quicken format.")); + } else { + descriptionLabel->setText(i18n("The CSV type uses a comma delimeted text file that can be used by\n" + "most popular spreadsheet programs available for Linux and other operating\n" + "systems.")); + } +} + +QString KChooseImportExportDlg::importExportType(void) +{ + return typeCombo->currentText(); +} + +void KChooseImportExportDlg::readConfig(void) +{ + KConfig *config = KGlobal::config(); + config->setGroup("Last Use Settings"); + m_lastType = config->readEntry("KChooseImportExportDlg_LastType"); +} + +void KChooseImportExportDlg::writeConfig(void) +{ + KConfig *config = KGlobal::config(); + config->setGroup("Last Use Settings"); + config->writeEntry("KChooseImportExportDlg_LastType", typeCombo->currentText()); + config->sync(); +} + +#include "kchooseimportexportdlg.moc" -- cgit v1.2.1