[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bknipptasch=5D_plugins=3A_add_xml_plugin_and_cleanup?=
From: Stefan_Böhmann <kde () hilefoks ! org>
Date: 2011-01-31 23:37:23
Message-ID: 20110131233723.A25C4A60D1 () git ! kde ! org
[Download RAW message or body]
Git commit 09ebe3bcaf46e95f49c62f63f7e0a1dd5ae8cd05 by Stefan Böhmann.
Pushed by sboehmann into branch 'master'.
add xml plugin and cleanup
M +3 -4 plugins/CMakeLists.txt
A +56 -0 plugins/csv/CMakeLists.txt [License: UNKNOWN]
A +399 -0 plugins/csv/csvexportdialog.cpp [License: GPL (v2+)]
A +74 -0 plugins/csv/csvexportdialog.h [License: GPL (v2+)]
A +597 -0 plugins/csv/csvexportdialog.ui [License: UNKNOWN]
A +75 -0 plugins/csv/csvexportplugin.cpp [License: GPL (v2+)]
A +52 -0 plugins/csv/csvexportplugin.h [License: GPL (v2+)]
A +104 -0 plugins/csv/csvimportdialog.cpp [License: GPL (v2+)]
A +58 -0 plugins/csv/csvimportdialog.h [License: GPL (v2+)]
A +317 -0 plugins/csv/csvimportdialog.ui [License: UNKNOWN]
A +85 -0 plugins/csv/csvimportplugin.cpp [License: GPL (v2+)]
A +52 -0 plugins/csv/csvimportplugin.h [License: GPL (v2+)]
D +0 -24 plugins/csv_export/CMakeLists.txt
D +0 -399 plugins/csv_export/csvexportdialog.cpp
D +0 -74 plugins/csv_export/csvexportdialog.h
D +0 -597 plugins/csv_export/csvexportdialog.ui
D +0 -75 plugins/csv_export/csvexportplugin.cpp
D +0 -52 plugins/csv_export/csvexportplugin.h
D +0 -24 plugins/csv_import/CMakeLists.txt
D +0 -104 plugins/csv_import/csvimportdialog.cpp
D +0 -58 plugins/csv_import/csvimportdialog.h
D +0 -317 plugins/csv_import/csvimportdialog.ui
D +0 -85 plugins/csv_import/csvimportplugin.cpp
D +0 -52 plugins/csv_import/csvimportplugin.h
A +15 -0 plugins/demo/CMakeLists.txt [License: UNKNOWN]
A +245 -0 plugins/demo/demoimportplugin.cpp [License: GPL (v2+)]
A +52 -0 plugins/demo/demoimportplugin.h [License: GPL (v2+)]
D +0 -15 plugins/demo_import/CMakeLists.txt
D +0 -245 plugins/demo_import/demoimportplugin.cpp
D +0 -52 plugins/demo_import/demoimportplugin.h
A +56 -0 plugins/xml/CMakeLists.txt [License: UNKNOWN]
M +23 -1 plugins/xml/xmlexportplugin.cpp
M +11 -3 plugins/xml/xmlexportplugin.h
M +23 -1 plugins/xml/xmlimportplugin.cpp
M +11 -3 plugins/xml/xmlimportplugin.h
http://commits.kde.org/knipptasch/09ebe3bcaf46e95f49c62f63f7e0a1dd5ae8cd05
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index ddafc5a..a122b7e 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -3,8 +3,7 @@ set( knipptasch_plugin_MINOR_VERSION ${knipptasch_MINOR_VERSION} )
set( knipptasch_plugin_PATCH_LEVEL ${knipptasch_PATCH_LEVEL} )
set( knipptasch_plugin_VERSION_SUFFIX ${knipptasch_VERSION_SUFFIX} )
-macro_optional_add_subdirectory( csv_export )
-macro_optional_add_subdirectory( csv_import )
-macro_optional_add_subdirectory( demo_import )
-#macro_optional_add_subdirectory( xml )
+macro_optional_add_subdirectory( csv )
+macro_optional_add_subdirectory( demo )
+macro_optional_add_subdirectory( xml )
diff --git a/plugins/csv/CMakeLists.txt b/plugins/csv/CMakeLists.txt
new file mode 100644
index 0000000..777d1b7
--- /dev/null
+++ b/plugins/csv/CMakeLists.txt
@@ -0,0 +1,56 @@
+project( knipptasch_csv_plugin )
+
+
+###################################################################################
+#### knipptasch_csv_export_plugin
+###################################################################################
+
+set( knipptasch_export_plugin_SOURCES
+ csvexportdialog.cpp
+ csvexportplugin.cpp
+ )
+
+set( knipptasch_export_plugin_HEADERS
+ csvexportdialog.h
+ csvexportplugin.h
+ )
+
+set( knipptasch_export_plugin_FORMS
+ csvexportdialog.ui
+ )
+
+qt4_wrap_ui( knipptasch_export_plugin_SOURCES ${knipptasch_export_plugin_FORMS} )
+qt4_wrap_cpp( knipptasch_export_plugin_SOURCES ${knipptasch_export_plugin_HEADERS} )
+
+add_library( knipptasch_csv_export_plugin SHARED ${knipptasch_export_plugin_SOURCES} \
) +target_link_libraries( knipptasch_csv_export_plugin ${QT_LIBRARIES} knipptasch \
compat ) +
+install( TARGETS knipptasch_csv_export_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} ) +
+
+
+###################################################################################
+#### knipptasch_csv_import_plugin
+###################################################################################
+
+set( knipptasch_import_plugin_SOURCES
+ csvimportdialog.cpp
+ csvimportplugin.cpp
+ )
+
+set( knipptasch_import_plugin_HEADERS
+ csvimportdialog.h
+ csvimportplugin.h
+ )
+
+set( knipptasch_import_plugin_FORMS
+ csvimportdialog.ui
+ )
+
+qt4_wrap_ui( knipptasch_import_plugin_SOURCES ${knipptasch_import_plugin_FORMS} )
+qt4_wrap_cpp( knipptasch_import_plugin_SOURCES ${knipptasch_import_plugin_HEADERS} )
+
+add_library( knipptasch_csv_import_plugin SHARED ${knipptasch_import_plugin_SOURCES} \
) +target_link_libraries( knipptasch_csv_import_plugin ${QT_LIBRARIES} knipptasch \
compat ) +
+install( TARGETS knipptasch_csv_import_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} )
diff --git a/plugins/csv/csvexportdialog.cpp b/plugins/csv/csvexportdialog.cpp
new file mode 100644
index 0000000..f745225
--- /dev/null
+++ b/plugins/csv/csvexportdialog.cpp
@@ -0,0 +1,399 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "csvexportdialog.h"
+#include "ui_csvexportdialog.h"
+
+#include "backend/account.h"
+#include "backend/posting.h"
+#include "backend/money.h"
+
+#include "compat/iconloader.h"
+
+#include <QDate>
+#include <QCoreApplication>
+#include <QDialogButtonBox>
+#include <QTextCodec>
+#include <QPushButton>
+
+#include <KLineEdit>
+
+#if defined(HAVE_KDE)
+#include <KFileDialog>
+#include <KMessageBox>
+#else
+#include <QFileDialog>
+#include <QMessageBox>
+#endif
+
+#include <QApplication>
+#include <QBuffer>
+#include <QTimer>
+
+#include <QDebug>
+
+#include <unistd.h>
+
+
+
+CsvExportDialog::CsvExportDialog(const Account *account, const QList<const Posting*> \
&selected, QWidget *parent) + : QDialog( parent ),
+ ui( new Ui::CsvExportDialog ),
+ m_account( account ),
+ m_selectedPostings( selected ),
+ m_updateTimer( new QTimer( this ) )
+{
+ Q_ASSERT( m_account );
+
+ ui->setupUi( this );
+
+ setWindowTitle( tr( "CSV Export - %1" ).arg( QCoreApplication::applicationName() \
) ); + ui->iconLabel->setPixmap( DesktopIcon("text-csv") );
+
+ m_updateTimer->setInterval( 300 );
+
+ ui->allInYearEdit->setDate( QDate::currentDate() );
+ ui->allBetweenDateStart->setDate( account->openingDate().isValid()
+ ? account->openingDate()
+ : QDate( 1, 1, QDate::currentDate().year() )
+ );
+ ui->allBetweenDateEnd->setDate( QDate::currentDate() );
+
+ if( !m_selectedPostings.isEmpty() ) {
+ ui->selected->setEnabled( true );
+ ui->selected->setChecked( true );
+ }
+ else {
+ ui->selected->setEnabled( false );
+ ui->all->setChecked( true );
+ }
+
+ const QLocale l;
+
+ ui->decimalSymbol->clear();
+ ui->decimalSymbol->addItem( "" );
+ ui->decimalSymbol->addItem( "," );
+ ui->decimalSymbol->addItem( "." );
+ if( ui->decimalSymbol->findText( l.decimalPoint() ) < 0 ) {
+ ui->decimalSymbol->addItem( l.decimalPoint() );
+ }
+ Q_ASSERT( ui->decimalSymbol->findText( l.decimalPoint() ) >= 0 );
+ ui->decimalSymbol->setCurrentIndex( ui->decimalSymbol->findText( \
l.decimalPoint() ) ); +
+ ui->decimalSymbol->setEnabled( false ); //TODO
+
+ ui->thousandsSeparator->clear();
+ ui->thousandsSeparator->addItem( "" );
+ ui->thousandsSeparator->addItem( "." );
+ ui->thousandsSeparator->setCurrentIndex( 0 );
+ ui->thousandsSeparator->setEnabled( false ); //TODO
+
+ ui->textquote->clear();
+ ui->textquote->addItem( "" );
+ ui->textquote->addItem( "\"" );
+ ui->textquote->addItem( "'" );
+ ui->textquote->addItem( "`" );
+ ui->textquote->setCurrentIndex( 1 );
+
+ ui->delimiter->clear();
+ ui->delimiter->addItem( "" );
+ ui->delimiter->addItem( tr( "Comma" ), "," );
+ ui->delimiter->addItem( tr( "Tabulator" ), "\t" );
+ ui->delimiter->addItem( tr( "Semicolon" ), ";" );
+ ui->delimiter->addItem( tr( "Space" ), " " );
+ ui->delimiter->setCurrentIndex( 3 );
+
+ QString df = tr(
+ "<p>These expressions may be used for the date format:</p>"
+ "<table>"
+ "<tr><th>Expression</th><th>Output</th></tr>"
+ "<tr><td>d</td><td>The day as a number without a leading zero (1 to \
31)</td></tr>" + "<tr><td>dd</td><td>The day as a number with a leading zero \
(01 to 31)</td></tr>" + "<tr><td>ddd</td><td>The abbreviated localized day \
name (e.g. 'Mon' to 'Sun')</td></tr>" + "<tr><td>dddd</td><td>The long \
localized day name (e.g. 'Monday' to 'Sunday')</td></tr>" + \
"<tr><td>M</td><td>The month as a number without a leading zero (1 to 12)</td></tr>" \
+ "<tr><td>MM</td><td>The month as a number with a leading zero (01 to \
12)</td></tr>" + "<tr><td>MMM</td><td>The abbreviated localized month name \
(e.g. 'Jan' to 'Dec')</td></tr>" + "<tr><td>MMMM</td><td>The long localized \
month name (e.g. 'January' to 'December')</td></tr>" + "<tr><td>yy</td><td>The \
year as two digit number (00 to 99)</td></tr>" + "<tr><td>yyyy</td><td>The \
year as four digit number</td></tr>" + "</table>"
+ "<table>"
+ "<tr><th>Expression</th><th>Output</th></tr>"
+ "<tr><td>Text Date</td><td>%1</td></tr>"
+ "<tr><td>ISO Date</td><td>%2</td></tr>"
+ "<tr><td>Short Date</td><td>%3</td></tr>"
+ "<tr><td>Long Date</td><td>%4</td></tr>"
+ )
+ .arg( "ddd MMM d yyyy" )
+ .arg( "yyyy-MM-dd" )
+ .arg( l.dateFormat( QLocale::ShortFormat ) )
+ .arg( l.dateFormat( QLocale::LongFormat ) );
+
+ ui->dateFormat->setToolTip( df );
+ ui->dateFormat->setWhatsThis( df );
+
+ ui->dateFormat->clear();
+ ui->dateFormat->addItem( "" );
+ ui->dateFormat->addItem( tr( "Text Date" ), "ddd MMM d yyyy" );
+ ui->dateFormat->addItem( tr( "ISO Date" ), "yyyy-MM-dd" );
+ ui->dateFormat->addItem( tr( "Short Date" ), l.dateFormat( QLocale::ShortFormat \
) ); + ui->dateFormat->addItem( tr( "Long Date" ), l.dateFormat( \
QLocale::LongFormat ) ); + ui->dateFormat->setCurrentIndex( 2 );
+
+ ui->encoding->clear();
+ foreach(const QByteArray &name, QTextCodec::availableCodecs() ) {
+ ui->encoding->addItem( name, name );
+ }
+ ui->encoding->setCurrentIndex( ui->encoding->findData(
+ QTextCodec::codecForLocale()->name() ) );
+
+ ui->endOfLine->clear();
+ ui->endOfLine->addItem( tr( "Unix" ), "\n" );
+ ui->endOfLine->addItem( tr( "Windows/DOS" ), "\r\n" );
+ ui->endOfLine->addItem( tr( "Macintosh" ), "\r" );
+
+#if defined( Q_WS_WIN )
+ ui->endOfLine->setCurrentIndex( 1 );
+#elif defined( Q_WS_MAC )
+ ui->endOfLine->setCurrentIndex( 2 );
+#else
+ ui->endOfLine->setCurrentIndex( 0 );
+#endif
+
+ ui->buttonBox->button( QDialogButtonBox::Save )->setEnabled( false );
+
+ connect( ui->delimiter, SIGNAL( activated(int) ),
+ this, SLOT( onDelimiterComboBoxIndexChanged(int) ) );
+ connect( ui->delimiter->lineEdit(), SIGNAL( textEdited(QString) ),
+ this, SLOT( onDelimiterComboBoxTextChanged() ) );
+
+ connect( ui->dateFormat, SIGNAL( activated(int) ),
+ this, SLOT( onDateFormatComboBoxIndexChanged(int) ) );
+ connect( ui->dateFormat->lineEdit(), SIGNAL( textEdited(QString) ),
+ this, SLOT( onDateFormatComboBoxTextChanged() ) );
+
+ connect( ui->all, SIGNAL( toggled(bool) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->selected, SIGNAL( toggled(bool) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->allInYear, SIGNAL( toggled(bool) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->allBetween, SIGNAL( toggled(bool) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->allInYearEdit, SIGNAL( dateChanged(QDate) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->allBetweenDateStart, SIGNAL( dateChanged(QDate) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->allBetweenDateEnd, SIGNAL( dateChanged(QDate) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->textquote, SIGNAL( editTextChanged(QString) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->decimalSymbol, SIGNAL( editTextChanged(QString) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->thousandsSeparator, SIGNAL( editTextChanged(QString) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->encoding, SIGNAL( activated(int) ),
+ this, SLOT( onStartUpdateTimer() ) );
+ connect( ui->endOfLine, SIGNAL( activated(int) ),
+ this, SLOT( onStartUpdateTimer() ) );
+
+ connect( ui->buttonBox->button( QDialogButtonBox::Save ), SIGNAL( clicked() ),
+ this, SLOT( onSave() ) );
+
+ connect( m_updateTimer, SIGNAL( timeout() ),
+ this, SLOT( onUpdatePreview() ) );
+
+ onDateFormatComboBoxIndexChanged( ui->dateFormat->currentIndex() );
+ onDelimiterComboBoxIndexChanged( ui->delimiter->currentIndex() );
+}
+
+
+CsvExportDialog::~CsvExportDialog()
+{
+ delete ui;
+}
+
+
+void CsvExportDialog::onStartUpdateTimer()
+{
+ Q_ASSERT( ui->buttonBox->button( QDialogButtonBox::Save ) );
+
+ ui->buttonBox->button( QDialogButtonBox::Save )->setEnabled( false );
+
+ m_updateTimer->start();
+}
+
+
+void CsvExportDialog::onUpdatePreview()
+{
+ ui->preview->clear();
+ ui->rowCountLabel->setText( QString::number( 0 ) );
+ ui->columnCountLabel->setText( QString::number( 0 ) );
+ ui->characterCountLabel->setText( QString::number( 0 ) );
+
+ m_result.clear();
+
+ QList<const Posting*> postings;
+
+ if( ui->all->isChecked() ) {
+ postings = m_account->postings();
+ }
+ else if( ui->selected->isChecked() ) {
+ postings = m_selectedPostings;
+ }
+ else if( ui->allInYear->isChecked() ) {
+ QList<const Posting*> plist = m_account->postings();
+ int year = ui->allInYearEdit->date().year();
+
+ foreach(const Posting *p, plist) {
+ if( ( p->maturity().isValid() && p->maturity().year() == year ) ||
+ ( p->valueDate().isValid() && p->valueDate().year() == year ) ) {
+ postings.append( p );
+ }
+ }
+ }
+ else if( ui->allBetween->isChecked() ) {
+ QList<const Posting*> plist = m_account->postings();
+
+ QDate start = ui->allBetweenDateStart->date();
+ QDate end = ui->allBetweenDateEnd->date() > start
+ ? ui->allBetweenDateEnd->date()
+ : start;
+
+ Q_ASSERT( start.isValid() );
+ Q_ASSERT( end.isValid() );
+
+ foreach(const Posting *p, plist) {
+ if( ( p->maturity().isValid() && p->maturity() >= start && p->maturity() \
<= end ) || + ( p->valueDate().isValid() && p->valueDate() >= start && \
p->valueDate() <= end ) ) { + postings.append( p );
+ }
+ }
+ }
+ else {
+ Q_ASSERT( false );
+ }
+
+ QString eof = ui->endOfLine->itemData( ui->endOfLine->currentIndex() \
).toString(); + QString tq = ui->textquote->currentText();
+
+ QBuffer buffer( &m_result );
+ buffer.open( QIODevice::WriteOnly );
+
+ QTextStream out( &buffer );
+ out.setCodec( QTextCodec::codecForName(
+ ui->encoding->itemData( ui->encoding->currentIndex() )
+ .toByteArray()
+ ) );
+
+ for(int i = 0; i < postings.size(); ++i) {
+ const Posting *p = postings[ i ];
+
+ out << tq << p->valueDate().toString( m_dateFormat ) << tq << m_delimiter;
+ out << tq << p->postingText() << tq << m_delimiter;
+ out << tq << p->maturity().toString( m_dateFormat ) << tq << m_delimiter;
+ out << tq << p->amount().toString() << tq << m_delimiter;
+ out << eof;
+ }
+
+ buffer.close();
+
+ ui->rowCountLabel->setText( QString::number( postings.size() ) );
+ ui->columnCountLabel->setText( QString::number( postings.size() * 4 ) );
+ ui->characterCountLabel->setText( QString::number( m_result.size() ) );
+
+ ui->preview->setPlainText( m_result );
+
+ Q_ASSERT( ui->buttonBox->button( QDialogButtonBox::Save ) );
+ ui->buttonBox->button( QDialogButtonBox::Save )
+ ->setEnabled( !m_result.isEmpty() );
+}
+
+void CsvExportDialog::onSave()
+{
+ hide();
+
+ QString filename;
+
+#if defined(HAVE_KDE)
+ filename = KFileDialog::getSaveFileName( KUrl(), "*.csv|" + tr( "All Supported \
Files" ), this ); +#else
+ filename = QFileDialog::getSaveFileName( this, // krazy:exclude=qclasses
+ tr( "Export File - %1" ).arg( \
QCoreApplication::applicationName() ), + QString(), tr( "All \
Supported Files" ) + " (*.csv)" + );
+#endif
+
+ if( filename.isEmpty() ) {
+ rejected();
+ return;
+ }
+
+ QFile file( filename );
+ if( !file.open( QIODevice::WriteOnly ) ) {
+ QString message = tr( "The file given could not be written; "
+ "check whether it exists or is writeable "
+ "for the current user." );
+#if defined(HAVE_KDE)
+ KMessageBox::error( parentWidget(), message );
+#else
+ QMessageBox::warning( parentWidget(), // krazy:exclude=qclasses
+ tr( "Error - %1" )
+ .arg( QCoreApplication::applicationName() ),
+ message );
+#endif
+ reject();
+ return;
+ }
+
+ file.write( m_result );
+ file.close();
+
+ accept();
+}
+
+
+void CsvExportDialog::onDelimiterComboBoxIndexChanged(int index)
+{
+ m_delimiter = ui->delimiter->itemData( index ).toString();
+ onStartUpdateTimer();
+}
+
+
+void CsvExportDialog::onDelimiterComboBoxTextChanged()
+{
+ m_delimiter = ui->delimiter->currentText();
+ onStartUpdateTimer();
+}
+
+
+void CsvExportDialog::onDateFormatComboBoxIndexChanged(int index)
+{
+ m_dateFormat = ui->dateFormat->itemData( index ).toString();
+ onStartUpdateTimer();
+}
+
+
+void CsvExportDialog::onDateFormatComboBoxTextChanged()
+{
+ m_dateFormat = ui->dateFormat->currentText();
+ onStartUpdateTimer();
+}
+
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv/csvexportdialog.h b/plugins/csv/csvexportdialog.h
new file mode 100644
index 0000000..68698f3
--- /dev/null
+++ b/plugins/csv/csvexportdialog.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef CSVEXPORTDIALOG_H
+#define CSVEXPORTDIALOG_H
+
+#include <QDialog>
+#include <QList>
+
+class QTimer;
+class Posting;
+class Account;
+
+namespace Ui
+{
+ class CsvExportDialog;
+}
+
+
+/**
+ * @class CsvExportDialog
+ * @brief
+ *
+ * @author Stefan Böhmann <kde@hilefoks.org>
+ */
+class CsvExportDialog : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ CsvExportDialog(const Account *account, const QList<const Posting*> \
&selected, QWidget *parent = 0); + ~CsvExportDialog();
+
+ private slots:
+ void onStartUpdateTimer();
+ void onUpdatePreview();
+
+ void onSave();
+
+ void onDelimiterComboBoxIndexChanged(int);
+ void onDelimiterComboBoxTextChanged();
+
+ void onDateFormatComboBoxIndexChanged(int index);
+ void onDateFormatComboBoxTextChanged();
+
+ private:
+ Ui::CsvExportDialog *ui;
+
+ const Account *m_account;
+ QList<const Posting*> m_selectedPostings;
+
+ QString m_delimiter;
+ QString m_dateFormat;
+ QByteArray m_result;
+ QTimer *m_updateTimer;
+};
+
+#endif
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv/csvexportdialog.ui b/plugins/csv/csvexportdialog.ui
new file mode 100644
index 0000000..8307a1c
--- /dev/null
+++ b/plugins/csv/csvexportdialog.ui
@@ -0,0 +1,597 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <author>Stefan Böhmann</author>
+ <class>CsvExportDialog</class>
+ <widget class="QDialog" name="CsvExportDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>699</width>
+ <height>632</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="2">
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Date format:</string>
+ </property>
+ <property name="buddy">
+ <cstring>dateFormat</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="dateFormat">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Decimal symbol:</string>
+ </property>
+ <property name="buddy">
+ <cstring>decimalSymbol</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KComboBox" name="decimalSymbol">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Thousands separator:</string>
+ </property>
+ <property name="buddy">
+ <cstring>thousandsSeparator</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="KComboBox" name="thousandsSeparator">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="3" rowspan="2">
+ <layout class="QFormLayout" name="formLayout_3">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Encoding:</string>
+ </property>
+ <property name="buddy">
+ <cstring>encoding</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="encoding">
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>End of Line:</string>
+ </property>
+ <property name="buddy">
+ <cstring>endOfLine</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KComboBox" name="endOfLine">
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Delimiter:</string>
+ </property>
+ <property name="buddy">
+ <cstring>delimiter</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="delimiter">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Text quote:</string>
+ </property>
+ <property name="buddy">
+ <cstring>textquote</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KComboBox" name="textquote">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="4">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="selectionGroupBox">
+ <property name="title">
+ <string>Selection</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QRadioButton" name="all">
+ <property name="text">
+ <string>All</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="selected">
+ <property name="text">
+ <string>Selected</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QRadioButton" name="allInYear">
+ <property name="text">
+ <string>All in:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDateEdit" name="allInYearEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="displayFormat">
+ <string>yyyy</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QRadioButton" name="allBetween">
+ <property name="text">
+ <string>All between:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDateEdit" name="allBetweenDateStart">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="displayFormat">
+ <string>M/d/yyyy</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>and</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDateEdit" name="allBetweenDateEnd">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="displayFormat">
+ <string>M/d/yyyy</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="iconLabel">
+ <property name="text">
+ <string comment="KDE::DoNotExtract">icon</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_11">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>CSV Export</string>
+ </property>
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <property name="indent">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0">
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Preview</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <property name="horizontalSpacing">
+ <number>-1</number>
+ </property>
+ <property name="verticalSpacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="font">
+ <font>
+ <family>DejaVu Sans Mono</family>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Rows:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="rowCountLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <family>DejaVu Sans Mono</family>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string comment="KDE::DoNotExtract">0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="label_12">
+ <property name="font">
+ <font>
+ <family>DejaVu Sans Mono</family>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Columns:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="columnCountLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <family>DejaVu Sans Mono</family>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string comment="KDE::DoNotExtract">0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QLabel" name="label_13">
+ <property name="font">
+ <font>
+ <family>DejaVu Sans Mono</family>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Characters:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="5">
+ <widget class="QLabel" name="characterCountLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <family>DejaVu Sans Mono</family>
+ <pointsize>7</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string comment="KDE::DoNotExtract">0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="6">
+ <widget class="QPlainTextEdit" name="preview">
+ <property name="undoRedoEnabled">
+ <bool>false</bool>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>selected</tabstop>
+ <tabstop>all</tabstop>
+ <tabstop>allInYear</tabstop>
+ <tabstop>allInYearEdit</tabstop>
+ <tabstop>allBetween</tabstop>
+ <tabstop>allBetweenDateStart</tabstop>
+ <tabstop>allBetweenDateEnd</tabstop>
+ <tabstop>delimiter</tabstop>
+ <tabstop>textquote</tabstop>
+ <tabstop>dateFormat</tabstop>
+ <tabstop>decimalSymbol</tabstop>
+ <tabstop>thousandsSeparator</tabstop>
+ <tabstop>encoding</tabstop>
+ <tabstop>endOfLine</tabstop>
+ <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>allInYear</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>allInYearEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>70</x>
+ <y>143</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>146</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>allBetween</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>allBetweenDateStart</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>86</x>
+ <y>176</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>259</x>
+ <y>179</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>allBetween</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>label</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>121</x>
+ <y>176</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>290</x>
+ <y>179</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>allBetween</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>allBetweenDateEnd</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>29</x>
+ <y>176</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>423</x>
+ <y>179</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>CsvExportDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>584</x>
+ <y>415</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>593</x>
+ <y>487</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/plugins/csv/csvexportplugin.cpp b/plugins/csv/csvexportplugin.cpp
new file mode 100644
index 0000000..0f8a9d3
--- /dev/null
+++ b/plugins/csv/csvexportplugin.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "csvexportplugin.h"
+#include "csvexportdialog.h"
+
+#include "compat/iconloader.h"
+
+#include <QPointer>
+
+
+CsvExportPlugin::CsvExportPlugin(QObject *parent)
+ : QObject( parent )
+{
+}
+
+
+QByteArray CsvExportPlugin::pluginIdentifier() const
+{
+ return "csv_export_plugin";
+}
+
+
+QString CsvExportPlugin::pluginName() const
+{
+ return tr( "CSV Export Plugin" );
+
+}
+
+
+QByteArray CsvExportPlugin::pluginVersion() const
+{
+ return "0.0.1";
+}
+
+
+QString CsvExportPlugin::exportActionName() const
+{
+ return QObject::tr( "Export &CSV File..." );
+}
+
+
+QPixmap CsvExportPlugin::exportActionIcon() const
+{
+ return BarIcon("text-csv");
+}
+
+
+void CsvExportPlugin::exportAccount(const Account *account, const QList<const \
Posting*> &selected, QWidget *parent) const +{
+ QPointer<CsvExportDialog> dialog = new CsvExportDialog( account, selected, \
parent ); +
+ dialog->exec();
+
+ delete dialog;
+}
+
+
+Q_EXPORT_PLUGIN2( "CsvExportPlugin", CsvExportPlugin );
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv/csvexportplugin.h b/plugins/csv/csvexportplugin.h
new file mode 100644
index 0000000..2c1727e
--- /dev/null
+++ b/plugins/csv/csvexportplugin.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef CSVEXPORTPLUGIN_H
+#define CSVEXPORTPLUGIN_H
+
+#include <Knipptasch/ExportPlugin>
+
+
+/**
+ * @class CsvExportPlugin
+ * @brief
+ *
+ * @author Stefan Böhmann <kde@hilefoks.org>
+ */
+class CsvExportPlugin : public QObject, public Knipptasch::ExportPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES( Knipptasch::Plugin )
+ Q_INTERFACES( Knipptasch::ExportPlugin )
+
+ public:
+ CsvExportPlugin(QObject *parent = 0);
+
+ QByteArray pluginIdentifier() const;
+ QString pluginName() const;
+ QByteArray pluginVersion() const;
+
+ QString exportActionName() const;
+ QPixmap exportActionIcon() const;
+
+ void exportAccount(const Account *account, const QList<const Posting*> \
&selected, QWidget *parent = 0) const; +};
+
+
+#endif
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv/csvimportdialog.cpp b/plugins/csv/csvimportdialog.cpp
new file mode 100644
index 0000000..05a208d
--- /dev/null
+++ b/plugins/csv/csvimportdialog.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "csvimportdialog.h"
+#include "ui_csvimportdialog.h"
+
+#include "backend/account.h"
+
+#include "compat/iconloader.h"
+
+#include <QDate>
+#include <QCoreApplication>
+#include <QTextCodec>
+
+#include <KLineEdit>
+
+#include <QDebug>
+
+
+CsvImportDialog::CsvImportDialog(QWidget *parent)
+ : QDialog( parent ),
+ ui( new Ui::CsvImportDialog )
+{
+ ui->setupUi( this );
+
+ setWindowTitle( tr( "CSV Import - %1" ).arg( QCoreApplication::applicationName() \
) ); + ui->iconLabel->setPixmap( DesktopIcon("text-csv") );
+
+ ui->fileButton->setIcon( BarIcon("document-open") );
+
+ ui->delimiter->clear();
+ ui->delimiter->addItem( "" );
+ ui->delimiter->addItem( tr( "Comma" ), ',' );
+ ui->delimiter->addItem( tr( "Tabulator" ), '\t' );
+ ui->delimiter->addItem( tr( "Semicolon" ), ';' );
+ ui->delimiter->addItem( tr( "Space" ), ' ' );
+ ui->delimiter->setCurrentIndex( 3 );
+ m_delimiter = ui->delimiter->itemData( 3 ).toChar();
+
+ ui->encoding->clear();
+ foreach(const QByteArray &name, QTextCodec::availableCodecs() ) {
+ ui->encoding->addItem( name, name );
+ }
+ ui->encoding->setCurrentIndex( ui->encoding->findData( \
QTextCodec::codecForLocale()->name() ) ); +
+ ui->endOfLine->clear();
+ ui->endOfLine->addItem( tr( "Unix" ) );
+ ui->endOfLine->addItem( tr( "Windows/DOS" ) );
+ ui->endOfLine->addItem( tr( "Macintosh" ) );
+
+#if defined( Q_WS_WIN )
+ ui->endOfLine->setCurrentIndex( 1 );
+#elif defined( Q_WS_MAC )
+ ui->endOfLine->setCurrentIndex( 2 );
+#else
+ ui->endOfLine->setCurrentIndex( 0 );
+#endif
+
+ connect( ui->delimiter, SIGNAL( activated(int) ), this, SLOT( \
onDelimiterComboBoxIndexChanged(int) ) ); + connect( ui->delimiter->lineEdit(), \
SIGNAL( textEdited(QString) ), this, SLOT( onDelimiterComboBoxTextChanged() ) ); +}
+
+
+CsvImportDialog::~CsvImportDialog()
+{
+ delete ui;
+}
+
+
+Account* CsvImportDialog::account() const
+{
+ return 0;
+}
+
+
+void CsvImportDialog::onDelimiterComboBoxIndexChanged(int index)
+{
+ m_delimiter = ui->delimiter->itemData( index ).toChar();
+}
+
+
+void CsvImportDialog::onDelimiterComboBoxTextChanged()
+{
+ m_delimiter = ui->delimiter->currentText();
+}
+
+
+
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv/csvimportdialog.h b/plugins/csv/csvimportdialog.h
new file mode 100644
index 0000000..a87e308
--- /dev/null
+++ b/plugins/csv/csvimportdialog.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef CSVIMPORTDIALOG_H
+#define CSVIMPORTDIALOG_H
+
+#include <QDialog>
+
+class Account;
+
+namespace Ui
+{
+ class CsvImportDialog;
+}
+
+
+/**
+ * @class CsvImportDialog
+ * @brief
+ *
+ * @author Stefan Böhmann <kde@hilefoks.org>
+ */
+class CsvImportDialog : public QDialog
+{
+ Q_OBJECT
+
+ public:
+ CsvImportDialog(QWidget *parent = 0);
+ ~CsvImportDialog();
+
+ Account* account() const;
+
+ private slots:
+ void onDelimiterComboBoxIndexChanged(int);
+ void onDelimiterComboBoxTextChanged();
+
+ private:
+ QString m_delimiter;
+ Ui::CsvImportDialog *ui;
+};
+
+#endif
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv/csvimportdialog.ui b/plugins/csv/csvimportdialog.ui
new file mode 100644
index 0000000..7fa8770
--- /dev/null
+++ b/plugins/csv/csvimportdialog.ui
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <author>Stefan Böhmann</author>
+ <class>CsvImportDialog</class>
+ <widget class="QDialog" name="CsvImportDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>923</width>
+ <height>438</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="iconLabel">
+ <property name="text">
+ <string comment="KDE::DoNotExtract">icon</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_11">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>CSV Import</string>
+ </property>
+ <property name="margin">
+ <number>3</number>
+ </property>
+ <property name="indent">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QFormLayout" name="formLayout_4">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>File to import:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="KLineEdit" name="filename"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="fileButton">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" rowspan="2">
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Delimiter:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="delimiter">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Text quote:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="KComboBox" name="textquote">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="checkBox_2">
+ <property name="text">
+ <string>Ignore duplicate delimiters</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="2">
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Date format:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="dateFormat">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Decimal symbol:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KComboBox" name="decimalSymbol">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Thousands separator:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="KComboBox" name="thousandsSeparator">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="4" rowspan="2">
+ <layout class="QFormLayout" name="formLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Encoding:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KComboBox" name="encoding">
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>End of Line:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KComboBox" name="endOfLine">
+ <property name="minimumContentsLength">
+ <number>8</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="checkBox">
+ <property name="text">
+ <string>Skip first row of file</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="5">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="3">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="1">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTableView" name="view">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/csv/csvimportplugin.cpp b/plugins/csv/csvimportplugin.cpp
new file mode 100644
index 0000000..c1ae668
--- /dev/null
+++ b/plugins/csv/csvimportplugin.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "csvimportplugin.h"
+#include "csvimportdialog.h"
+
+#include "backend/account.h"
+
+#include <compat/iconloader.h>
+#include <QPointer>
+
+
+
+CsvImportPlugin::CsvImportPlugin(QObject *parent)
+ : QObject( parent )
+{
+
+}
+
+
+QByteArray CsvImportPlugin::pluginIdentifier() const
+{
+ return "csv_import_plugin";
+}
+
+
+QString CsvImportPlugin::pluginName() const
+{
+ return tr( "CSV Import Plugin" );
+
+}
+
+
+QByteArray CsvImportPlugin::pluginVersion() const
+{
+ return "0.0.1";
+}
+
+
+QString CsvImportPlugin::importActionName() const
+{
+ return QObject::tr( "Import &CSV File..." );
+}
+
+
+QPixmap CsvImportPlugin::importActionIcon() const
+{
+ return BarIcon("text-csv");
+}
+
+
+Account* CsvImportPlugin::importAccount(QWidget *parent) const
+{
+ QPointer<CsvImportDialog> dialog = new CsvImportDialog( parent );
+ Account *account = 0;
+
+ if( dialog->exec() == QDialog::Accepted ) {
+ if( dialog ) {
+ account = dialog->account();
+ }
+ }
+
+ delete dialog;
+
+ return account;
+}
+
+
+Q_EXPORT_PLUGIN2( "CsvImportPlugin", CsvImportPlugin );
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv/csvimportplugin.h b/plugins/csv/csvimportplugin.h
new file mode 100644
index 0000000..e310ffa
--- /dev/null
+++ b/plugins/csv/csvimportplugin.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef CSVIMPORTPLUGIN_H
+#define CSVIMPORTPLUGIN_H
+
+#include <Knipptasch/ImportPlugin>
+
+
+/**
+ * @class CsvImportPlugin
+ * @brief
+ *
+ * @author Stefan Böhmann <kde@hilefoks.org>
+ */
+class CsvImportPlugin : public QObject, public Knipptasch::ImportPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES( Knipptasch::Plugin )
+ Q_INTERFACES( Knipptasch::ImportPlugin )
+
+ public:
+ CsvImportPlugin(QObject *parent = 0);
+
+ QByteArray pluginIdentifier() const;
+ QString pluginName() const;
+ QByteArray pluginVersion() const;
+
+ QString importActionName() const;
+ QPixmap importActionIcon() const;
+
+ Account* importAccount(QWidget *parent = 0) const;
+};
+
+
+#endif
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/csv_export/CMakeLists.txt b/plugins/csv_export/CMakeLists.txt
deleted file mode 100644
index 3ec5ed1..0000000
--- a/plugins/csv_export/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-project( knipptasch_csv_export_plugin )
-
-set( knipptasch_plugin_SOURCES
- csvexportdialog.cpp
- csvexportplugin.cpp
- )
-
-set( knipptasch_plugin_HEADERS
- csvexportdialog.h
- csvexportplugin.h
- )
-
-set( knipptasch_plugin_FORMS
- csvexportdialog.ui
- )
-
-
-qt4_wrap_ui( knipptasch_plugin_SOURCES ${knipptasch_plugin_FORMS} )
-qt4_wrap_cpp( knipptasch_plugin_SOURCES ${knipptasch_plugin_HEADERS} )
-
-add_library( knipptasch_csv_export_plugin SHARED ${knipptasch_plugin_SOURCES} )
-target_link_libraries( knipptasch_csv_export_plugin ${QT_LIBRARIES} knipptasch \
compat )
-
-install( TARGETS knipptasch_csv_export_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} )
diff --git a/plugins/csv_export/csvexportdialog.cpp \
b/plugins/csv_export/csvexportdialog.cpp deleted file mode 100644
index f745225..0000000
--- a/plugins/csv_export/csvexportdialog.cpp
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include "csvexportdialog.h"
-#include "ui_csvexportdialog.h"
-
-#include "backend/account.h"
-#include "backend/posting.h"
-#include "backend/money.h"
-
-#include "compat/iconloader.h"
-
-#include <QDate>
-#include <QCoreApplication>
-#include <QDialogButtonBox>
-#include <QTextCodec>
-#include <QPushButton>
-
-#include <KLineEdit>
-
-#if defined(HAVE_KDE)
-#include <KFileDialog>
-#include <KMessageBox>
-#else
-#include <QFileDialog>
-#include <QMessageBox>
-#endif
-
-#include <QApplication>
-#include <QBuffer>
-#include <QTimer>
-
-#include <QDebug>
-
-#include <unistd.h>
-
-
-
-CsvExportDialog::CsvExportDialog(const Account *account, const QList<const Posting*> \
&selected, QWidget *parent)
- : QDialog( parent ),
- ui( new Ui::CsvExportDialog ),
- m_account( account ),
- m_selectedPostings( selected ),
- m_updateTimer( new QTimer( this ) )
-{
- Q_ASSERT( m_account );
-
- ui->setupUi( this );
-
- setWindowTitle( tr( "CSV Export - %1" ).arg( QCoreApplication::applicationName() \
) );
- ui->iconLabel->setPixmap( DesktopIcon("text-csv") );
-
- m_updateTimer->setInterval( 300 );
-
- ui->allInYearEdit->setDate( QDate::currentDate() );
- ui->allBetweenDateStart->setDate( account->openingDate().isValid()
- ? account->openingDate()
- : QDate( 1, 1, QDate::currentDate().year() )
- );
- ui->allBetweenDateEnd->setDate( QDate::currentDate() );
-
- if( !m_selectedPostings.isEmpty() ) {
- ui->selected->setEnabled( true );
- ui->selected->setChecked( true );
- }
- else {
- ui->selected->setEnabled( false );
- ui->all->setChecked( true );
- }
-
- const QLocale l;
-
- ui->decimalSymbol->clear();
- ui->decimalSymbol->addItem( "" );
- ui->decimalSymbol->addItem( "," );
- ui->decimalSymbol->addItem( "." );
- if( ui->decimalSymbol->findText( l.decimalPoint() ) < 0 ) {
- ui->decimalSymbol->addItem( l.decimalPoint() );
- }
- Q_ASSERT( ui->decimalSymbol->findText( l.decimalPoint() ) >= 0 );
- ui->decimalSymbol->setCurrentIndex( ui->decimalSymbol->findText( \
l.decimalPoint() ) );
-
- ui->decimalSymbol->setEnabled( false ); //TODO
-
- ui->thousandsSeparator->clear();
- ui->thousandsSeparator->addItem( "" );
- ui->thousandsSeparator->addItem( "." );
- ui->thousandsSeparator->setCurrentIndex( 0 );
- ui->thousandsSeparator->setEnabled( false ); //TODO
-
- ui->textquote->clear();
- ui->textquote->addItem( "" );
- ui->textquote->addItem( "\"" );
- ui->textquote->addItem( "'" );
- ui->textquote->addItem( "`" );
- ui->textquote->setCurrentIndex( 1 );
-
- ui->delimiter->clear();
- ui->delimiter->addItem( "" );
- ui->delimiter->addItem( tr( "Comma" ), "," );
- ui->delimiter->addItem( tr( "Tabulator" ), "\t" );
- ui->delimiter->addItem( tr( "Semicolon" ), ";" );
- ui->delimiter->addItem( tr( "Space" ), " " );
- ui->delimiter->setCurrentIndex( 3 );
-
- QString df = tr(
- "<p>These expressions may be used for the date format:</p>"
- "<table>"
- "<tr><th>Expression</th><th>Output</th></tr>"
- "<tr><td>d</td><td>The day as a number without a leading zero (1 to \
31)</td></tr>"
- "<tr><td>dd</td><td>The day as a number with a leading zero (01 to \
31)</td></tr>"
- "<tr><td>ddd</td><td>The abbreviated localized day name (e.g. 'Mon' to \
'Sun')</td></tr>"
- "<tr><td>dddd</td><td>The long localized day name (e.g. 'Monday' to \
'Sunday')</td></tr>"
- "<tr><td>M</td><td>The month as a number without a leading zero (1 to \
12)</td></tr>"
- "<tr><td>MM</td><td>The month as a number with a leading zero (01 to \
12)</td></tr>"
- "<tr><td>MMM</td><td>The abbreviated localized month name (e.g. 'Jan' to \
'Dec')</td></tr>"
- "<tr><td>MMMM</td><td>The long localized month name (e.g. 'January' to \
'December')</td></tr>"
- "<tr><td>yy</td><td>The year as two digit number (00 to 99)</td></tr>"
- "<tr><td>yyyy</td><td>The year as four digit number</td></tr>"
- "</table>"
- "<table>"
- "<tr><th>Expression</th><th>Output</th></tr>"
- "<tr><td>Text Date</td><td>%1</td></tr>"
- "<tr><td>ISO Date</td><td>%2</td></tr>"
- "<tr><td>Short Date</td><td>%3</td></tr>"
- "<tr><td>Long Date</td><td>%4</td></tr>"
- )
- .arg( "ddd MMM d yyyy" )
- .arg( "yyyy-MM-dd" )
- .arg( l.dateFormat( QLocale::ShortFormat ) )
- .arg( l.dateFormat( QLocale::LongFormat ) );
-
- ui->dateFormat->setToolTip( df );
- ui->dateFormat->setWhatsThis( df );
-
- ui->dateFormat->clear();
- ui->dateFormat->addItem( "" );
- ui->dateFormat->addItem( tr( "Text Date" ), "ddd MMM d yyyy" );
- ui->dateFormat->addItem( tr( "ISO Date" ), "yyyy-MM-dd" );
- ui->dateFormat->addItem( tr( "Short Date" ), l.dateFormat( QLocale::ShortFormat \
) );
- ui->dateFormat->addItem( tr( "Long Date" ), l.dateFormat( QLocale::LongFormat ) \
);
- ui->dateFormat->setCurrentIndex( 2 );
-
- ui->encoding->clear();
- foreach(const QByteArray &name, QTextCodec::availableCodecs() ) {
- ui->encoding->addItem( name, name );
- }
- ui->encoding->setCurrentIndex( ui->encoding->findData(
- QTextCodec::codecForLocale()->name() ) );
-
- ui->endOfLine->clear();
- ui->endOfLine->addItem( tr( "Unix" ), "\n" );
- ui->endOfLine->addItem( tr( "Windows/DOS" ), "\r\n" );
- ui->endOfLine->addItem( tr( "Macintosh" ), "\r" );
-
-#if defined( Q_WS_WIN )
- ui->endOfLine->setCurrentIndex( 1 );
-#elif defined( Q_WS_MAC )
- ui->endOfLine->setCurrentIndex( 2 );
-#else
- ui->endOfLine->setCurrentIndex( 0 );
-#endif
-
- ui->buttonBox->button( QDialogButtonBox::Save )->setEnabled( false );
-
- connect( ui->delimiter, SIGNAL( activated(int) ),
- this, SLOT( onDelimiterComboBoxIndexChanged(int) ) );
- connect( ui->delimiter->lineEdit(), SIGNAL( textEdited(QString) ),
- this, SLOT( onDelimiterComboBoxTextChanged() ) );
-
- connect( ui->dateFormat, SIGNAL( activated(int) ),
- this, SLOT( onDateFormatComboBoxIndexChanged(int) ) );
- connect( ui->dateFormat->lineEdit(), SIGNAL( textEdited(QString) ),
- this, SLOT( onDateFormatComboBoxTextChanged() ) );
-
- connect( ui->all, SIGNAL( toggled(bool) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->selected, SIGNAL( toggled(bool) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->allInYear, SIGNAL( toggled(bool) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->allBetween, SIGNAL( toggled(bool) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->allInYearEdit, SIGNAL( dateChanged(QDate) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->allBetweenDateStart, SIGNAL( dateChanged(QDate) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->allBetweenDateEnd, SIGNAL( dateChanged(QDate) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->textquote, SIGNAL( editTextChanged(QString) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->decimalSymbol, SIGNAL( editTextChanged(QString) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->thousandsSeparator, SIGNAL( editTextChanged(QString) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->encoding, SIGNAL( activated(int) ),
- this, SLOT( onStartUpdateTimer() ) );
- connect( ui->endOfLine, SIGNAL( activated(int) ),
- this, SLOT( onStartUpdateTimer() ) );
-
- connect( ui->buttonBox->button( QDialogButtonBox::Save ), SIGNAL( clicked() ),
- this, SLOT( onSave() ) );
-
- connect( m_updateTimer, SIGNAL( timeout() ),
- this, SLOT( onUpdatePreview() ) );
-
- onDateFormatComboBoxIndexChanged( ui->dateFormat->currentIndex() );
- onDelimiterComboBoxIndexChanged( ui->delimiter->currentIndex() );
-}
-
-
-CsvExportDialog::~CsvExportDialog()
-{
- delete ui;
-}
-
-
-void CsvExportDialog::onStartUpdateTimer()
-{
- Q_ASSERT( ui->buttonBox->button( QDialogButtonBox::Save ) );
-
- ui->buttonBox->button( QDialogButtonBox::Save )->setEnabled( false );
-
- m_updateTimer->start();
-}
-
-
-void CsvExportDialog::onUpdatePreview()
-{
- ui->preview->clear();
- ui->rowCountLabel->setText( QString::number( 0 ) );
- ui->columnCountLabel->setText( QString::number( 0 ) );
- ui->characterCountLabel->setText( QString::number( 0 ) );
-
- m_result.clear();
-
- QList<const Posting*> postings;
-
- if( ui->all->isChecked() ) {
- postings = m_account->postings();
- }
- else if( ui->selected->isChecked() ) {
- postings = m_selectedPostings;
- }
- else if( ui->allInYear->isChecked() ) {
- QList<const Posting*> plist = m_account->postings();
- int year = ui->allInYearEdit->date().year();
-
- foreach(const Posting *p, plist) {
- if( ( p->maturity().isValid() && p->maturity().year() == year ) ||
- ( p->valueDate().isValid() && p->valueDate().year() == year ) ) {
- postings.append( p );
- }
- }
- }
- else if( ui->allBetween->isChecked() ) {
- QList<const Posting*> plist = m_account->postings();
-
- QDate start = ui->allBetweenDateStart->date();
- QDate end = ui->allBetweenDateEnd->date() > start
- ? ui->allBetweenDateEnd->date()
- : start;
-
- Q_ASSERT( start.isValid() );
- Q_ASSERT( end.isValid() );
-
- foreach(const Posting *p, plist) {
- if( ( p->maturity().isValid() && p->maturity() >= start && p->maturity() \
<= end ) ||
- ( p->valueDate().isValid() && p->valueDate() >= start && \
p->valueDate() <= end ) ) {
- postings.append( p );
- }
- }
- }
- else {
- Q_ASSERT( false );
- }
-
- QString eof = ui->endOfLine->itemData( ui->endOfLine->currentIndex() \
).toString();
- QString tq = ui->textquote->currentText();
-
- QBuffer buffer( &m_result );
- buffer.open( QIODevice::WriteOnly );
-
- QTextStream out( &buffer );
- out.setCodec( QTextCodec::codecForName(
- ui->encoding->itemData( ui->encoding->currentIndex() )
- .toByteArray()
- ) );
-
- for(int i = 0; i < postings.size(); ++i) {
- const Posting *p = postings[ i ];
-
- out << tq << p->valueDate().toString( m_dateFormat ) << tq << m_delimiter;
- out << tq << p->postingText() << tq << m_delimiter;
- out << tq << p->maturity().toString( m_dateFormat ) << tq << m_delimiter;
- out << tq << p->amount().toString() << tq << m_delimiter;
- out << eof;
- }
-
- buffer.close();
-
- ui->rowCountLabel->setText( QString::number( postings.size() ) );
- ui->columnCountLabel->setText( QString::number( postings.size() * 4 ) );
- ui->characterCountLabel->setText( QString::number( m_result.size() ) );
-
- ui->preview->setPlainText( m_result );
-
- Q_ASSERT( ui->buttonBox->button( QDialogButtonBox::Save ) );
- ui->buttonBox->button( QDialogButtonBox::Save )
- ->setEnabled( !m_result.isEmpty() );
-}
-
-void CsvExportDialog::onSave()
-{
- hide();
-
- QString filename;
-
-#if defined(HAVE_KDE)
- filename = KFileDialog::getSaveFileName( KUrl(), "*.csv|" + tr( "All Supported \
Files" ), this );
-#else
- filename = QFileDialog::getSaveFileName( this, // krazy:exclude=qclasses
- tr( "Export File - %1" ).arg( \
QCoreApplication::applicationName() ),
- QString(), tr( "All Supported Files" ) + " (*.csv)"
- );
-#endif
-
- if( filename.isEmpty() ) {
- rejected();
- return;
- }
-
- QFile file( filename );
- if( !file.open( QIODevice::WriteOnly ) ) {
- QString message = tr( "The file given could not be written; "
- "check whether it exists or is writeable "
- "for the current user." );
-#if defined(HAVE_KDE)
- KMessageBox::error( parentWidget(), message );
-#else
- QMessageBox::warning( parentWidget(), // krazy:exclude=qclasses
- tr( "Error - %1" )
- .arg( QCoreApplication::applicationName() ),
- message );
-#endif
- reject();
- return;
- }
-
- file.write( m_result );
- file.close();
-
- accept();
-}
-
-
-void CsvExportDialog::onDelimiterComboBoxIndexChanged(int index)
-{
- m_delimiter = ui->delimiter->itemData( index ).toString();
- onStartUpdateTimer();
-}
-
-
-void CsvExportDialog::onDelimiterComboBoxTextChanged()
-{
- m_delimiter = ui->delimiter->currentText();
- onStartUpdateTimer();
-}
-
-
-void CsvExportDialog::onDateFormatComboBoxIndexChanged(int index)
-{
- m_dateFormat = ui->dateFormat->itemData( index ).toString();
- onStartUpdateTimer();
-}
-
-
-void CsvExportDialog::onDateFormatComboBoxTextChanged()
-{
- m_dateFormat = ui->dateFormat->currentText();
- onStartUpdateTimer();
-}
-
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/csv_export/csvexportdialog.h \
b/plugins/csv_export/csvexportdialog.h deleted file mode 100644
index 68698f3..0000000
--- a/plugins/csv_export/csvexportdialog.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef CSVEXPORTDIALOG_H
-#define CSVEXPORTDIALOG_H
-
-#include <QDialog>
-#include <QList>
-
-class QTimer;
-class Posting;
-class Account;
-
-namespace Ui
-{
- class CsvExportDialog;
-}
-
-
-/**
- * @class CsvExportDialog
- * @brief
- *
- * @author Stefan Böhmann <kde@hilefoks.org>
- */
-class CsvExportDialog : public QDialog
-{
- Q_OBJECT
-
- public:
- CsvExportDialog(const Account *account, const QList<const Posting*> \
&selected, QWidget *parent = 0);
- ~CsvExportDialog();
-
- private slots:
- void onStartUpdateTimer();
- void onUpdatePreview();
-
- void onSave();
-
- void onDelimiterComboBoxIndexChanged(int);
- void onDelimiterComboBoxTextChanged();
-
- void onDateFormatComboBoxIndexChanged(int index);
- void onDateFormatComboBoxTextChanged();
-
- private:
- Ui::CsvExportDialog *ui;
-
- const Account *m_account;
- QList<const Posting*> m_selectedPostings;
-
- QString m_delimiter;
- QString m_dateFormat;
- QByteArray m_result;
- QTimer *m_updateTimer;
-};
-
-#endif
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/csv_export/csvexportdialog.ui \
b/plugins/csv_export/csvexportdialog.ui deleted file mode 100644
index 8307a1c..0000000
--- a/plugins/csv_export/csvexportdialog.ui
+++ /dev/null
@@ -1,597 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <author>Stefan Böhmann</author>
- <class>CsvExportDialog</class>
- <widget class="QDialog" name="CsvExportDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>699</width>
- <height>632</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="2" column="0">
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="2">
- <layout class="QFormLayout" name="formLayout_2">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Date format:</string>
- </property>
- <property name="buddy">
- <cstring>dateFormat</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="dateFormat">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Decimal symbol:</string>
- </property>
- <property name="buddy">
- <cstring>decimalSymbol</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KComboBox" name="decimalSymbol">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Thousands separator:</string>
- </property>
- <property name="buddy">
- <cstring>thousandsSeparator</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="KComboBox" name="thousandsSeparator">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="3" rowspan="2">
- <layout class="QFormLayout" name="formLayout_3">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Encoding:</string>
- </property>
- <property name="buddy">
- <cstring>encoding</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="encoding">
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>End of Line:</string>
- </property>
- <property name="buddy">
- <cstring>endOfLine</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KComboBox" name="endOfLine">
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Delimiter:</string>
- </property>
- <property name="buddy">
- <cstring>delimiter</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="delimiter">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Text quote:</string>
- </property>
- <property name="buddy">
- <cstring>textquote</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KComboBox" name="textquote">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="4">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QGroupBox" name="selectionGroupBox">
- <property name="title">
- <string>Selection</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="all">
- <property name="text">
- <string>All</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="selected">
- <property name="text">
- <string>Selected</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QRadioButton" name="allInYear">
- <property name="text">
- <string>All in:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDateEdit" name="allInYearEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="displayFormat">
- <string>yyyy</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QRadioButton" name="allBetween">
- <property name="text">
- <string>All between:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDateEdit" name="allBetweenDateStart">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="displayFormat">
- <string>M/d/yyyy</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>and</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDateEdit" name="allBetweenDateEnd">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="displayFormat">
- <string>M/d/yyyy</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="iconLabel">
- <property name="text">
- <string comment="KDE::DoNotExtract">icon</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_11">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>CSV Export</string>
- </property>
- <property name="margin">
- <number>3</number>
- </property>
- <property name="indent">
- <number>5</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0">
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Preview</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <property name="horizontalSpacing">
- <number>-1</number>
- </property>
- <property name="verticalSpacing">
- <number>0</number>
- </property>
- <property name="margin">
- <number>2</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_10">
- <property name="font">
- <font>
- <family>DejaVu Sans Mono</family>
- <pointsize>7</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Rows:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="rowCountLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <family>DejaVu Sans Mono</family>
- <pointsize>7</pointsize>
- </font>
- </property>
- <property name="text">
- <string comment="KDE::DoNotExtract">0</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_12">
- <property name="font">
- <font>
- <family>DejaVu Sans Mono</family>
- <pointsize>7</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Columns:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QLabel" name="columnCountLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <family>DejaVu Sans Mono</family>
- <pointsize>7</pointsize>
- </font>
- </property>
- <property name="text">
- <string comment="KDE::DoNotExtract">0</string>
- </property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QLabel" name="label_13">
- <property name="font">
- <font>
- <family>DejaVu Sans Mono</family>
- <pointsize>7</pointsize>
- </font>
- </property>
- <property name="text">
- <string>Characters:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="5">
- <widget class="QLabel" name="characterCountLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <family>DejaVu Sans Mono</family>
- <pointsize>7</pointsize>
- </font>
- </property>
- <property name="text">
- <string comment="KDE::DoNotExtract">0</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="6">
- <widget class="QPlainTextEdit" name="preview">
- <property name="undoRedoEnabled">
- <bool>false</bool>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>selected</tabstop>
- <tabstop>all</tabstop>
- <tabstop>allInYear</tabstop>
- <tabstop>allInYearEdit</tabstop>
- <tabstop>allBetween</tabstop>
- <tabstop>allBetweenDateStart</tabstop>
- <tabstop>allBetweenDateEnd</tabstop>
- <tabstop>delimiter</tabstop>
- <tabstop>textquote</tabstop>
- <tabstop>dateFormat</tabstop>
- <tabstop>decimalSymbol</tabstop>
- <tabstop>thousandsSeparator</tabstop>
- <tabstop>encoding</tabstop>
- <tabstop>endOfLine</tabstop>
- <tabstop>buttonBox</tabstop>
- </tabstops>
- <resources/>
- <connections>
- <connection>
- <sender>allInYear</sender>
- <signal>toggled(bool)</signal>
- <receiver>allInYearEdit</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>70</x>
- <y>143</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>146</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>allBetween</sender>
- <signal>toggled(bool)</signal>
- <receiver>allBetweenDateStart</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>86</x>
- <y>176</y>
- </hint>
- <hint type="destinationlabel">
- <x>259</x>
- <y>179</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>allBetween</sender>
- <signal>toggled(bool)</signal>
- <receiver>label</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>121</x>
- <y>176</y>
- </hint>
- <hint type="destinationlabel">
- <x>290</x>
- <y>179</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>allBetween</sender>
- <signal>toggled(bool)</signal>
- <receiver>allBetweenDateEnd</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>29</x>
- <y>176</y>
- </hint>
- <hint type="destinationlabel">
- <x>423</x>
- <y>179</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>CsvExportDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>584</x>
- <y>415</y>
- </hint>
- <hint type="destinationlabel">
- <x>593</x>
- <y>487</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/plugins/csv_export/csvexportplugin.cpp \
b/plugins/csv_export/csvexportplugin.cpp deleted file mode 100644
index 8fb0567..0000000
--- a/plugins/csv_export/csvexportplugin.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include "csvexportplugin.h"
-#include "csvexportdialog.h"
-
-#include "compat/iconloader.h"
-
-#include <QPointer>
-
-
-CsvExportPlugin::CsvExportPlugin(QObject *parent)
- : QObject( parent )
-{
-}
-
-
-QByteArray CsvExportPlugin::pluginIdentifier() const
-{
- return "csv_export_plugin";
-}
-
-
-QString CsvExportPlugin::pluginName() const
-{
- return tr( "CSV Export Plugin" );
-
-}
-
-
-QByteArray CsvExportPlugin::pluginVersion() const
-{
- return "0.0.1";
-}
-
-
-QString CsvExportPlugin::exportActionName() const
-{
- return QObject::tr( "Export &CSV File..." );
-}
-
-
-QPixmap CsvExportPlugin::exportActionIcon() const
-{
- return BarIcon("text-csv");
-}
-
-
-void CsvExportPlugin::exportAccount(const Account *account, const QList<const \
Posting*> &selected, QWidget *parent) const
-{
- QPointer<CsvExportDialog> dialog = new CsvExportDialog( account, selected, \
parent );
-
- dialog->exec();
-
- delete dialog;
-}
-
-
-Q_EXPORT_PLUGIN2( "CsvExportPlugin", CsvExportPlugin );
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/csv_export/csvexportplugin.h \
b/plugins/csv_export/csvexportplugin.h deleted file mode 100644
index 2c1727e..0000000
--- a/plugins/csv_export/csvexportplugin.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef CSVEXPORTPLUGIN_H
-#define CSVEXPORTPLUGIN_H
-
-#include <Knipptasch/ExportPlugin>
-
-
-/**
- * @class CsvExportPlugin
- * @brief
- *
- * @author Stefan Böhmann <kde@hilefoks.org>
- */
-class CsvExportPlugin : public QObject, public Knipptasch::ExportPlugin
-{
- Q_OBJECT
- Q_INTERFACES( Knipptasch::Plugin )
- Q_INTERFACES( Knipptasch::ExportPlugin )
-
- public:
- CsvExportPlugin(QObject *parent = 0);
-
- QByteArray pluginIdentifier() const;
- QString pluginName() const;
- QByteArray pluginVersion() const;
-
- QString exportActionName() const;
- QPixmap exportActionIcon() const;
-
- void exportAccount(const Account *account, const QList<const Posting*> \
&selected, QWidget *parent = 0) const;
-};
-
-
-#endif
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/csv_import/CMakeLists.txt b/plugins/csv_import/CMakeLists.txt
deleted file mode 100644
index ed53b9b..0000000
--- a/plugins/csv_import/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-project( knipptasch_csv_import_plugin )
-
-set( knipptasch_plugin_SOURCES
- csvimportdialog.cpp
- csvimportplugin.cpp
- )
-
-set( knipptasch_plugin_HEADERS
- csvimportdialog.h
- csvimportplugin.h
- )
-
-set( knipptasch_plugin_FORMS
- csvimportdialog.ui
- )
-
-
-qt4_wrap_ui( knipptasch_plugin_SOURCES ${knipptasch_plugin_FORMS} )
-qt4_wrap_cpp( knipptasch_plugin_SOURCES ${knipptasch_plugin_HEADERS} )
-
-add_library( knipptasch_csv_import_plugin SHARED ${knipptasch_plugin_SOURCES} )
-target_link_libraries( knipptasch_csv_import_plugin ${QT_LIBRARIES} knipptasch \
compat )
-
-install( TARGETS knipptasch_csv_import_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} )
diff --git a/plugins/csv_import/csvimportdialog.cpp \
b/plugins/csv_import/csvimportdialog.cpp deleted file mode 100644
index 05a208d..0000000
--- a/plugins/csv_import/csvimportdialog.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include "csvimportdialog.h"
-#include "ui_csvimportdialog.h"
-
-#include "backend/account.h"
-
-#include "compat/iconloader.h"
-
-#include <QDate>
-#include <QCoreApplication>
-#include <QTextCodec>
-
-#include <KLineEdit>
-
-#include <QDebug>
-
-
-CsvImportDialog::CsvImportDialog(QWidget *parent)
- : QDialog( parent ),
- ui( new Ui::CsvImportDialog )
-{
- ui->setupUi( this );
-
- setWindowTitle( tr( "CSV Import - %1" ).arg( QCoreApplication::applicationName() \
) );
- ui->iconLabel->setPixmap( DesktopIcon("text-csv") );
-
- ui->fileButton->setIcon( BarIcon("document-open") );
-
- ui->delimiter->clear();
- ui->delimiter->addItem( "" );
- ui->delimiter->addItem( tr( "Comma" ), ',' );
- ui->delimiter->addItem( tr( "Tabulator" ), '\t' );
- ui->delimiter->addItem( tr( "Semicolon" ), ';' );
- ui->delimiter->addItem( tr( "Space" ), ' ' );
- ui->delimiter->setCurrentIndex( 3 );
- m_delimiter = ui->delimiter->itemData( 3 ).toChar();
-
- ui->encoding->clear();
- foreach(const QByteArray &name, QTextCodec::availableCodecs() ) {
- ui->encoding->addItem( name, name );
- }
- ui->encoding->setCurrentIndex( ui->encoding->findData( \
QTextCodec::codecForLocale()->name() ) );
-
- ui->endOfLine->clear();
- ui->endOfLine->addItem( tr( "Unix" ) );
- ui->endOfLine->addItem( tr( "Windows/DOS" ) );
- ui->endOfLine->addItem( tr( "Macintosh" ) );
-
-#if defined( Q_WS_WIN )
- ui->endOfLine->setCurrentIndex( 1 );
-#elif defined( Q_WS_MAC )
- ui->endOfLine->setCurrentIndex( 2 );
-#else
- ui->endOfLine->setCurrentIndex( 0 );
-#endif
-
- connect( ui->delimiter, SIGNAL( activated(int) ), this, SLOT( \
onDelimiterComboBoxIndexChanged(int) ) );
- connect( ui->delimiter->lineEdit(), SIGNAL( textEdited(QString) ), this, SLOT( \
onDelimiterComboBoxTextChanged() ) );
-}
-
-
-CsvImportDialog::~CsvImportDialog()
-{
- delete ui;
-}
-
-
-Account* CsvImportDialog::account() const
-{
- return 0;
-}
-
-
-void CsvImportDialog::onDelimiterComboBoxIndexChanged(int index)
-{
- m_delimiter = ui->delimiter->itemData( index ).toChar();
-}
-
-
-void CsvImportDialog::onDelimiterComboBoxTextChanged()
-{
- m_delimiter = ui->delimiter->currentText();
-}
-
-
-
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/csv_import/csvimportdialog.h \
b/plugins/csv_import/csvimportdialog.h deleted file mode 100644
index a87e308..0000000
--- a/plugins/csv_import/csvimportdialog.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef CSVIMPORTDIALOG_H
-#define CSVIMPORTDIALOG_H
-
-#include <QDialog>
-
-class Account;
-
-namespace Ui
-{
- class CsvImportDialog;
-}
-
-
-/**
- * @class CsvImportDialog
- * @brief
- *
- * @author Stefan Böhmann <kde@hilefoks.org>
- */
-class CsvImportDialog : public QDialog
-{
- Q_OBJECT
-
- public:
- CsvImportDialog(QWidget *parent = 0);
- ~CsvImportDialog();
-
- Account* account() const;
-
- private slots:
- void onDelimiterComboBoxIndexChanged(int);
- void onDelimiterComboBoxTextChanged();
-
- private:
- QString m_delimiter;
- Ui::CsvImportDialog *ui;
-};
-
-#endif
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/csv_import/csvimportdialog.ui \
b/plugins/csv_import/csvimportdialog.ui deleted file mode 100644
index 7fa8770..0000000
--- a/plugins/csv_import/csvimportdialog.ui
+++ /dev/null
@@ -1,317 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <author>Stefan Böhmann</author>
- <class>CsvImportDialog</class>
- <widget class="QDialog" name="CsvImportDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>923</width>
- <height>438</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="iconLabel">
- <property name="text">
- <string comment="KDE::DoNotExtract">icon</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_11">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>CSV Import</string>
- </property>
- <property name="margin">
- <number>3</number>
- </property>
- <property name="indent">
- <number>5</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QFormLayout" name="formLayout_4">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>File to import:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="KLineEdit" name="filename"/>
- </item>
- <item>
- <widget class="QToolButton" name="fileButton">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" rowspan="2">
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Delimiter:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="delimiter">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Text quote:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="KComboBox" name="textquote">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="checkBox_2">
- <property name="text">
- <string>Ignore duplicate delimiters</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="2">
- <layout class="QFormLayout" name="formLayout_2">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Date format:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="dateFormat">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="currentIndex">
- <number>-1</number>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Decimal symbol:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KComboBox" name="decimalSymbol">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Thousands separator:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="KComboBox" name="thousandsSeparator">
- <property name="editable">
- <bool>true</bool>
- </property>
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="4" rowspan="2">
- <layout class="QFormLayout" name="formLayout_3">
- <item row="0" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Encoding:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="encoding">
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>End of Line:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KComboBox" name="endOfLine">
- <property name="minimumContentsLength">
- <number>8</number>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QCheckBox" name="checkBox">
- <property name="text">
- <string>Skip first row of file</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="5">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="3">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="0" column="1">
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QTableView" name="view">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>1</horstretch>
- <verstretch>1</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/plugins/csv_import/csvimportplugin.cpp \
b/plugins/csv_import/csvimportplugin.cpp deleted file mode 100644
index de61662..0000000
--- a/plugins/csv_import/csvimportplugin.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include "csvimportplugin.h"
-#include "csvimportdialog.h"
-
-#include "backend/account.h"
-
-#include <compat/iconloader.h>
-#include <QPointer>
-
-
-
-CsvImportPlugin::CsvImportPlugin(QObject *parent)
- : QObject( parent )
-{
-
-}
-
-
-QByteArray CsvImportPlugin::pluginIdentifier() const
-{
- return "csv_import_plugin";
-}
-
-
-QString CsvImportPlugin::pluginName() const
-{
- return tr( "CSV Import Plugin" );
-
-}
-
-
-QByteArray CsvImportPlugin::pluginVersion() const
-{
- return "0.0.1";
-}
-
-
-QString CsvImportPlugin::importActionName() const
-{
- return QObject::tr( "Import &CSV File..." );
-}
-
-
-QPixmap CsvImportPlugin::importActionIcon() const
-{
- return BarIcon("text-csv");
-}
-
-
-Account* CsvImportPlugin::importAccount(QWidget *parent) const
-{
- QPointer<CsvImportDialog> dialog = new CsvImportDialog( parent );
- Account *account = 0;
-
- if( dialog->exec() == QDialog::Accepted ) {
- if( dialog ) {
- account = dialog->account();
- }
- }
-
- delete dialog;
-
- return account;
-}
-
-
-Q_EXPORT_PLUGIN2( "CsvImportPlugin", CsvImportPlugin );
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/csv_import/csvimportplugin.h \
b/plugins/csv_import/csvimportplugin.h deleted file mode 100644
index e310ffa..0000000
--- a/plugins/csv_import/csvimportplugin.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef CSVIMPORTPLUGIN_H
-#define CSVIMPORTPLUGIN_H
-
-#include <Knipptasch/ImportPlugin>
-
-
-/**
- * @class CsvImportPlugin
- * @brief
- *
- * @author Stefan Böhmann <kde@hilefoks.org>
- */
-class CsvImportPlugin : public QObject, public Knipptasch::ImportPlugin
-{
- Q_OBJECT
- Q_INTERFACES( Knipptasch::Plugin )
- Q_INTERFACES( Knipptasch::ImportPlugin )
-
- public:
- CsvImportPlugin(QObject *parent = 0);
-
- QByteArray pluginIdentifier() const;
- QString pluginName() const;
- QByteArray pluginVersion() const;
-
- QString importActionName() const;
- QPixmap importActionIcon() const;
-
- Account* importAccount(QWidget *parent = 0) const;
-};
-
-
-#endif
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/demo/CMakeLists.txt b/plugins/demo/CMakeLists.txt
new file mode 100644
index 0000000..88abb6b
--- /dev/null
+++ b/plugins/demo/CMakeLists.txt
@@ -0,0 +1,15 @@
+project( knipptasch_demo_import_plugin )
+
+set( knipptasch_plugin_SOURCES
+ demoimportplugin.cpp
+ )
+
+set( knipptasch_plugin_HEADERS
+ demoimportplugin.h
+ )
+
+qt4_wrap_cpp( knipptasch_plugin_SOURCES ${knipptasch_plugin_HEADERS} )
+add_library( knipptasch_demo_import_plugin SHARED ${knipptasch_plugin_SOURCES} )
+target_link_libraries( knipptasch_demo_import_plugin ${QT_LIBRARIES} knipptasch \
compat ) +
+install( TARGETS knipptasch_demo_import_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} )
diff --git a/plugins/demo/demoimportplugin.cpp b/plugins/demo/demoimportplugin.cpp
new file mode 100644
index 0000000..f9d2461
--- /dev/null
+++ b/plugins/demo/demoimportplugin.cpp
@@ -0,0 +1,245 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "demoimportplugin.h"
+
+#include <Knipptasch/Account>
+#include <Knipptasch/Posting>
+#include <Knipptasch/Money>
+#include <Knipptasch/Category>
+
+#include <compat/iconloader.h>
+
+#include <QPixmap>
+#include <QInputDialog>
+#include <QDate>
+
+#include <QDebug>
+
+
+
+Money initDemoAccountAddPosting(Account *acc, const QDate &date, const QString \
&postingText, const Money &amount, bool valueDate = true) +{
+ Q_ASSERT( acc );
+
+ Posting *p = new Posting;
+ p->setMaturity( date );
+ p->setPostingText( postingText );
+ p->setAmount( amount );
+ p->setValueDate( valueDate ? date.addDays( qrand() % 8 ) : QDate() );
+
+ acc->addPosting( p );
+
+ return p->amount();
+}
+
+Money initRent(Account *acc, const QDate &date)
+{
+ return initDemoAccountAddPosting( acc, date.addDays( qrand() % 6 ),
+ QObject::tr( "Rent" ) , -348.50,
+ date < QDate::currentDate() );
+}
+
+
+
+DemoImportPlugin::DemoImportPlugin(QObject *parent)
+ : QObject( parent )
+{
+ qsrand( QTime::currentTime().msec() );
+}
+
+
+QByteArray DemoImportPlugin::pluginIdentifier() const
+{
+ return "demo_import_plugin";
+}
+
+
+QString DemoImportPlugin::pluginName() const
+{
+ return tr( "Demo Import Plugin" );
+
+}
+
+
+QByteArray DemoImportPlugin::pluginVersion() const
+{
+ return "0.0.1";
+}
+
+
+QString DemoImportPlugin::importActionName() const
+{
+ return QObject::tr( "Import &Example File" );
+}
+
+
+QPixmap DemoImportPlugin::importActionIcon() const
+{
+ return BarIcon("applications-education-miscellaneous");
+}
+
+
+Account* DemoImportPlugin::importAccount(QWidget *parent) const
+{
+ bool ok;
+ int count = QInputDialog::getInt( parent, // krazy:exclude=qclasses
+ QString(),
+ QObject::tr("Past month:"),
+ 15, 1, 120, 1, &ok );
+ if( ok ) {
+ QList<int> v;
+ v << -5 << -10 << -15 << -20 << -25 << -30 << -35 << -40 << -50
+ << -60 << -70 << -80 << -90 << -100 << -120 << -130 << -150
+ << -200 << -250 << -300;
+
+ QStringList cost;
+ cost << QObject::tr( "ATM" );
+ cost << QObject::tr( "Food" );
+ cost << QObject::tr( "Clothes" );
+ cost << QObject::tr( "Reading material" );
+ cost << QObject::tr( "Repairs" );
+ cost << QObject::tr( "Fuel" );
+ cost << QObject::tr( "Books" );
+ cost << QObject::tr( "Dining Out" );
+ cost << QObject::tr( "Gifts" );
+ cost << QObject::tr( "Tax" );
+ cost << QObject::tr( "Insurance" );
+ cost << QObject::tr( "Office Supplies" );
+
+ Account *acc = new Account;
+
+ acc->setName( QObject::tr( "Example Account" ) );
+ acc->setNumber( "105626320" );
+ acc->setOpeningBalance( 542.20 );
+ acc->setOpeningDate( QDate::currentDate().addMonths( -count ) );
+
+ {
+ Category *p = acc->rootCategory()->addCategory( QObject::tr( "Auto" ) );
+ p->setColor( Qt::blue );
+
+ p->addCategory( QObject::tr( "Fuel" ) )->setColor( Qt::red );
+ p->addCategory( QObject::tr( "Insurance" ) )->setColor( Qt::green );
+ p->addCategory( QObject::tr( "Tax" ) )->setColor( Qt::gray );
+ p->addCategory( QObject::tr( "Service" ) )->setColor( Qt::darkMagenta );
+ }
+ {
+ Category *p = acc->rootCategory()->addCategory( QObject::tr( "Food" ) );
+ p->setColor( Qt::cyan );
+ p->addCategory( QObject::tr( "Dining Out" ) )->setColor( Qt::darkBlue );
+ }
+ {
+ Category *p = acc->rootCategory()->addCategory( QObject::tr( \
"Recreation" ) ); + p->setColor( Qt::yellow );
+
+ p->addCategory( QObject::tr( "Books" ) )->setColor( Qt::darkRed );
+ p->addCategory( QObject::tr( "Photo" ) )->setColor( Qt::black );
+ p->addCategory( QObject::tr( "Sport" ) );
+ Category *p1 = p->addCategory( QObject::tr( "Culture" ) );
+ p1->setColor( Qt::darkGreen );
+ p1->addCategory( QObject::tr( "Theater" ) )->setColor( Qt::lightGray );
+ p1->addCategory( QObject::tr( "Stage" ) );
+ p1->addCategory( QObject::tr( "Exposition" ) );
+ p1->addCategory( QObject::tr( "Classical Music" ) );
+ p1->addCategory( QObject::tr( "Museum" ) );
+ p1->addCategory( QObject::tr( "Art" ) );
+ p->addCategory( QObject::tr( "Entertainment" ) )->setColor( \
Qt::darkYellow ); + }
+
+ Money total = acc->openingBalance();
+ for( QDate d = acc->openingDate(); d < QDate::currentDate().addMonths( 4 ); \
d = d.addMonths( 1 ) ) { + Money month;
+ QDate date( d.year(), d.month(), 1 );
+
+ month += initRent( acc, date );
+
+ if( date < QDate::currentDate() ) {
+ month += initDemoAccountAddPosting(
+ acc,
+ date.addDays( qrand() % 6 ),
+ QObject::tr( "Phone and Internet" ),
+ -20 - ( ( qrand() % 5000 + 100 ) / 100.00 )
+ );
+
+ month += initDemoAccountAddPosting(
+ acc,
+ date.addDays( qrand() % 6 ),
+ QObject::tr( "Salary" ),
+ 1000.00 + ( ( qrand() % 50000 + 100 ) / 100.00 )
+ );
+
+ if( total > 800.00 ) {
+ month += initDemoAccountAddPosting(
+ acc,
+ date.addDays( qrand() % date.daysInMonth() + 1 ),
+ QObject::tr( "Travel" ),
+ -1700.00 + ( ( qrand() % 50000 + 100 ) / 100.00 )
+ );
+ }
+
+ while( month > 200.0 ) {
+ month += initDemoAccountAddPosting(
+ acc,
+ date.addDays( qrand() % date.daysInMonth() + 1 ),
+ cost.at( qrand() % cost.size() ),
+ v[ qrand() % v.size() ]
+ );
+ }
+
+ if( month < -50.0 ) {
+ month += initDemoAccountAddPosting(
+ acc,
+ date.addDays( qrand() % date.daysInMonth() + 1 ),
+ QObject::tr( "Dividend" ),
+ Money( v[ qrand() % v.size() ] ).abs()
+ );
+ }
+ }
+ else {
+ month += initDemoAccountAddPosting(
+ acc,
+ date.addDays( qrand() % 6 ),
+ QObject::tr( "Phone and Internet" ),
+ Money(),
+ false
+ );
+
+ month += initDemoAccountAddPosting(
+ acc,
+ date.addDays( qrand() % 6 ),
+ QObject::tr( "Salary" ),
+ Money(),
+ false
+ );
+ }
+
+ total += month;
+ }
+
+ acc->setModified( false );
+
+ return acc;
+ }
+
+ return 0;
+}
+
+
+Q_EXPORT_PLUGIN2( "DemoImportPlugin", DemoImportPlugin );
+
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/demo/demoimportplugin.h b/plugins/demo/demoimportplugin.h
new file mode 100644
index 0000000..104c68a
--- /dev/null
+++ b/plugins/demo/demoimportplugin.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef DEMOIMPORTPLUGIN_H
+#define DEMOIMPORTPLUGIN_H
+
+#include <Knipptasch/ImportPlugin>
+
+
+/**
+ * @class DemoImportPlugin
+ * @brief
+ *
+ * @author Stefan Böhmann <kde@hilefoks.org>
+ */
+class DemoImportPlugin : public QObject, public Knipptasch::ImportPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES( Knipptasch::Plugin )
+ Q_INTERFACES( Knipptasch::ImportPlugin )
+
+ public:
+ DemoImportPlugin(QObject *parent = 0);
+
+ QByteArray pluginIdentifier() const;
+ QString pluginName() const;
+ QByteArray pluginVersion() const;
+
+ QString importActionName() const;
+ QPixmap importActionIcon() const;
+
+ Account* importAccount(QWidget *parent = 0) const;
+};
+
+
+#endif
+
+// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; +// vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/demo_import/CMakeLists.txt b/plugins/demo_import/CMakeLists.txt
deleted file mode 100644
index 88abb6b..0000000
--- a/plugins/demo_import/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-project( knipptasch_demo_import_plugin )
-
-set( knipptasch_plugin_SOURCES
- demoimportplugin.cpp
- )
-
-set( knipptasch_plugin_HEADERS
- demoimportplugin.h
- )
-
-qt4_wrap_cpp( knipptasch_plugin_SOURCES ${knipptasch_plugin_HEADERS} )
-add_library( knipptasch_demo_import_plugin SHARED ${knipptasch_plugin_SOURCES} )
-target_link_libraries( knipptasch_demo_import_plugin ${QT_LIBRARIES} knipptasch \
compat )
-
-install( TARGETS knipptasch_demo_import_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} )
diff --git a/plugins/demo_import/demoimportplugin.cpp \
b/plugins/demo_import/demoimportplugin.cpp deleted file mode 100644
index f9d2461..0000000
--- a/plugins/demo_import/demoimportplugin.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include "demoimportplugin.h"
-
-#include <Knipptasch/Account>
-#include <Knipptasch/Posting>
-#include <Knipptasch/Money>
-#include <Knipptasch/Category>
-
-#include <compat/iconloader.h>
-
-#include <QPixmap>
-#include <QInputDialog>
-#include <QDate>
-
-#include <QDebug>
-
-
-
-Money initDemoAccountAddPosting(Account *acc, const QDate &date, const QString \
&postingText, const Money &amount, bool valueDate = true)
-{
- Q_ASSERT( acc );
-
- Posting *p = new Posting;
- p->setMaturity( date );
- p->setPostingText( postingText );
- p->setAmount( amount );
- p->setValueDate( valueDate ? date.addDays( qrand() % 8 ) : QDate() );
-
- acc->addPosting( p );
-
- return p->amount();
-}
-
-Money initRent(Account *acc, const QDate &date)
-{
- return initDemoAccountAddPosting( acc, date.addDays( qrand() % 6 ),
- QObject::tr( "Rent" ) , -348.50,
- date < QDate::currentDate() );
-}
-
-
-
-DemoImportPlugin::DemoImportPlugin(QObject *parent)
- : QObject( parent )
-{
- qsrand( QTime::currentTime().msec() );
-}
-
-
-QByteArray DemoImportPlugin::pluginIdentifier() const
-{
- return "demo_import_plugin";
-}
-
-
-QString DemoImportPlugin::pluginName() const
-{
- return tr( "Demo Import Plugin" );
-
-}
-
-
-QByteArray DemoImportPlugin::pluginVersion() const
-{
- return "0.0.1";
-}
-
-
-QString DemoImportPlugin::importActionName() const
-{
- return QObject::tr( "Import &Example File" );
-}
-
-
-QPixmap DemoImportPlugin::importActionIcon() const
-{
- return BarIcon("applications-education-miscellaneous");
-}
-
-
-Account* DemoImportPlugin::importAccount(QWidget *parent) const
-{
- bool ok;
- int count = QInputDialog::getInt( parent, // krazy:exclude=qclasses
- QString(),
- QObject::tr("Past month:"),
- 15, 1, 120, 1, &ok );
- if( ok ) {
- QList<int> v;
- v << -5 << -10 << -15 << -20 << -25 << -30 << -35 << -40 << -50
- << -60 << -70 << -80 << -90 << -100 << -120 << -130 << -150
- << -200 << -250 << -300;
-
- QStringList cost;
- cost << QObject::tr( "ATM" );
- cost << QObject::tr( "Food" );
- cost << QObject::tr( "Clothes" );
- cost << QObject::tr( "Reading material" );
- cost << QObject::tr( "Repairs" );
- cost << QObject::tr( "Fuel" );
- cost << QObject::tr( "Books" );
- cost << QObject::tr( "Dining Out" );
- cost << QObject::tr( "Gifts" );
- cost << QObject::tr( "Tax" );
- cost << QObject::tr( "Insurance" );
- cost << QObject::tr( "Office Supplies" );
-
- Account *acc = new Account;
-
- acc->setName( QObject::tr( "Example Account" ) );
- acc->setNumber( "105626320" );
- acc->setOpeningBalance( 542.20 );
- acc->setOpeningDate( QDate::currentDate().addMonths( -count ) );
-
- {
- Category *p = acc->rootCategory()->addCategory( QObject::tr( "Auto" ) );
- p->setColor( Qt::blue );
-
- p->addCategory( QObject::tr( "Fuel" ) )->setColor( Qt::red );
- p->addCategory( QObject::tr( "Insurance" ) )->setColor( Qt::green );
- p->addCategory( QObject::tr( "Tax" ) )->setColor( Qt::gray );
- p->addCategory( QObject::tr( "Service" ) )->setColor( Qt::darkMagenta );
- }
- {
- Category *p = acc->rootCategory()->addCategory( QObject::tr( "Food" ) );
- p->setColor( Qt::cyan );
- p->addCategory( QObject::tr( "Dining Out" ) )->setColor( Qt::darkBlue );
- }
- {
- Category *p = acc->rootCategory()->addCategory( QObject::tr( \
"Recreation" ) );
- p->setColor( Qt::yellow );
-
- p->addCategory( QObject::tr( "Books" ) )->setColor( Qt::darkRed );
- p->addCategory( QObject::tr( "Photo" ) )->setColor( Qt::black );
- p->addCategory( QObject::tr( "Sport" ) );
- Category *p1 = p->addCategory( QObject::tr( "Culture" ) );
- p1->setColor( Qt::darkGreen );
- p1->addCategory( QObject::tr( "Theater" ) )->setColor( Qt::lightGray );
- p1->addCategory( QObject::tr( "Stage" ) );
- p1->addCategory( QObject::tr( "Exposition" ) );
- p1->addCategory( QObject::tr( "Classical Music" ) );
- p1->addCategory( QObject::tr( "Museum" ) );
- p1->addCategory( QObject::tr( "Art" ) );
- p->addCategory( QObject::tr( "Entertainment" ) )->setColor( \
Qt::darkYellow );
- }
-
- Money total = acc->openingBalance();
- for( QDate d = acc->openingDate(); d < QDate::currentDate().addMonths( 4 ); \
d = d.addMonths( 1 ) ) {
- Money month;
- QDate date( d.year(), d.month(), 1 );
-
- month += initRent( acc, date );
-
- if( date < QDate::currentDate() ) {
- month += initDemoAccountAddPosting(
- acc,
- date.addDays( qrand() % 6 ),
- QObject::tr( "Phone and Internet" ),
- -20 - ( ( qrand() % 5000 + 100 ) / 100.00 )
- );
-
- month += initDemoAccountAddPosting(
- acc,
- date.addDays( qrand() % 6 ),
- QObject::tr( "Salary" ),
- 1000.00 + ( ( qrand() % 50000 + 100 ) / 100.00 )
- );
-
- if( total > 800.00 ) {
- month += initDemoAccountAddPosting(
- acc,
- date.addDays( qrand() % date.daysInMonth() + 1 ),
- QObject::tr( "Travel" ),
- -1700.00 + ( ( qrand() % 50000 + 100 ) / 100.00 )
- );
- }
-
- while( month > 200.0 ) {
- month += initDemoAccountAddPosting(
- acc,
- date.addDays( qrand() % date.daysInMonth() + 1 ),
- cost.at( qrand() % cost.size() ),
- v[ qrand() % v.size() ]
- );
- }
-
- if( month < -50.0 ) {
- month += initDemoAccountAddPosting(
- acc,
- date.addDays( qrand() % date.daysInMonth() + 1 ),
- QObject::tr( "Dividend" ),
- Money( v[ qrand() % v.size() ] ).abs()
- );
- }
- }
- else {
- month += initDemoAccountAddPosting(
- acc,
- date.addDays( qrand() % 6 ),
- QObject::tr( "Phone and Internet" ),
- Money(),
- false
- );
-
- month += initDemoAccountAddPosting(
- acc,
- date.addDays( qrand() % 6 ),
- QObject::tr( "Salary" ),
- Money(),
- false
- );
- }
-
- total += month;
- }
-
- acc->setModified( false );
-
- return acc;
- }
-
- return 0;
-}
-
-
-Q_EXPORT_PLUGIN2( "DemoImportPlugin", DemoImportPlugin );
-
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/demo_import/demoimportplugin.h \
b/plugins/demo_import/demoimportplugin.h deleted file mode 100644
index 104c68a..0000000
--- a/plugins/demo_import/demoimportplugin.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2010 by Stefan Böhmann <kde@hilefoks.org>
- *
- * 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.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef DEMOIMPORTPLUGIN_H
-#define DEMOIMPORTPLUGIN_H
-
-#include <Knipptasch/ImportPlugin>
-
-
-/**
- * @class DemoImportPlugin
- * @brief
- *
- * @author Stefan Böhmann <kde@hilefoks.org>
- */
-class DemoImportPlugin : public QObject, public Knipptasch::ImportPlugin
-{
- Q_OBJECT
- Q_INTERFACES( Knipptasch::Plugin )
- Q_INTERFACES( Knipptasch::ImportPlugin )
-
- public:
- DemoImportPlugin(QObject *parent = 0);
-
- QByteArray pluginIdentifier() const;
- QString pluginName() const;
- QByteArray pluginVersion() const;
-
- QString importActionName() const;
- QPixmap importActionIcon() const;
-
- Account* importAccount(QWidget *parent = 0) const;
-};
-
-
-#endif
-
-// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on;
-// vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1:
diff --git a/plugins/xml/CMakeLists.txt b/plugins/xml/CMakeLists.txt
new file mode 100644
index 0000000..b79b3b1
--- /dev/null
+++ b/plugins/xml/CMakeLists.txt
@@ -0,0 +1,56 @@
+project( knipptasch_xml_plugin )
+
+
+###################################################################################
+#### knipptasch_xml_export_plugin
+###################################################################################
+
+set( knipptasch_export_plugin_SOURCES
+ xmlexportplugin.cpp
+ xmlwriter.cpp
+ )
+
+set( knipptasch_export_plugin_HEADERS
+ xmlexportplugin.h
+ xmlwriter.h
+ )
+
+set( knipptasch_export_plugin_FORMS
+ #xmlexportdialog.ui
+ )
+
+qt4_wrap_ui( knipptasch_export_plugin_SOURCES ${knipptasch_export_plugin_FORMS} )
+qt4_wrap_cpp( knipptasch_export_plugin_SOURCES ${knipptasch_export_plugin_HEADERS} )
+
+add_library( knipptasch_xml_export_plugin SHARED ${knipptasch_export_plugin_SOURCES} \
) +target_link_libraries( knipptasch_xml_export_plugin ${QT_LIBRARIES} knipptasch \
compat ) +
+install( TARGETS knipptasch_xml_export_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} ) +
+
+
+###################################################################################
+#### knipptasch_xml_import_plugin
+###################################################################################
+
+set( knipptasch_import_plugin_SOURCES
+ xmlimportplugin.cpp
+ xmlreader.cpp
+ )
+
+set( knipptasch_import_plugin_HEADERS
+ xmlimportplugin.h
+ xmlreader.h
+ )
+
+set( knipptasch_import_plugin_FORMS
+ #xmlimportdialog.ui
+ )
+
+qt4_wrap_ui( knipptasch_import_plugin_SOURCES ${knipptasch_import_plugin_FORMS} )
+qt4_wrap_cpp( knipptasch_import_plugin_SOURCES ${knipptasch_import_plugin_HEADERS} )
+
+add_library( knipptasch_xml_import_plugin SHARED ${knipptasch_import_plugin_SOURCES} \
) +target_link_libraries( knipptasch_xml_import_plugin ${QT_LIBRARIES} knipptasch \
compat ) +
+install( TARGETS knipptasch_xml_import_plugin DESTINATION \
${KNIPPTASCH_PLUGIN_INSTALL_DIR} )
diff --git a/plugins/xml/xmlexportplugin.cpp b/plugins/xml/xmlexportplugin.cpp
index 203ffb3..d7c6b9a 100644
--- a/plugins/xml/xmlexportplugin.cpp
+++ b/plugins/xml/xmlexportplugin.cpp
@@ -29,11 +29,31 @@
#include <QCoreApplication>
-XmlExportPlugin::XmlExportPlugin()
+XmlExportPlugin::XmlExportPlugin(QObject *parent)
+ : QObject( parent )
{
}
+QByteArray XmlExportPlugin::pluginIdentifier() const
+{
+ return "xml_export_plugin";
+}
+
+
+QString XmlExportPlugin::pluginName() const
+{
+ return tr( "XML Export Plugin" );
+
+}
+
+
+QByteArray XmlExportPlugin::pluginVersion() const
+{
+ return "0.0.1";
+}
+
+
QString XmlExportPlugin::exportActionName() const
{
return QObject::tr( "Export &XML File..." );
@@ -67,5 +87,7 @@ void XmlExportPlugin::exportAccount(const Account *account, const \
QList<const Po }
+Q_EXPORT_PLUGIN2( "XmlExportPlugin", XmlExportPlugin );
+
// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; // vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/xml/xmlexportplugin.h b/plugins/xml/xmlexportplugin.h
index 8578b3d..be5ac54 100644
--- a/plugins/xml/xmlexportplugin.h
+++ b/plugins/xml/xmlexportplugin.h
@@ -17,7 +17,7 @@
#ifndef XMLEXPORTPLUGIN_H
#define XMLEXPORTPLUGIN_H
-#include "interface/exportplugin.h"
+#include <Knipptasch/ExportPlugin>
/**
@@ -26,10 +26,18 @@
*
* @author Stefan Böhmann <kde@hilefoks.org>
*/
-class XmlExportPlugin : public ExportPlugin
+class XmlExportPlugin : public QObject, public Knipptasch::ExportPlugin
{
+ Q_OBJECT
+ Q_INTERFACES( Knipptasch::Plugin )
+ Q_INTERFACES( Knipptasch::ExportPlugin )
+
public:
- XmlExportPlugin();
+ XmlExportPlugin(QObject *parent = 0);
+
+ QByteArray pluginIdentifier() const;
+ QString pluginName() const;
+ QByteArray pluginVersion() const;
QString exportActionName() const;
QPixmap exportActionIcon() const;
diff --git a/plugins/xml/xmlimportplugin.cpp b/plugins/xml/xmlimportplugin.cpp
index 94b05d5..034e920 100644
--- a/plugins/xml/xmlimportplugin.cpp
+++ b/plugins/xml/xmlimportplugin.cpp
@@ -35,12 +35,32 @@
-XmlImportPlugin::XmlImportPlugin()
+XmlImportPlugin::XmlImportPlugin(QObject *parent)
+ : QObject( parent )
{
qsrand( QTime::currentTime().msec() );
}
+QByteArray XmlImportPlugin::pluginIdentifier() const
+{
+ return "xml_import_plugin";
+}
+
+
+QString XmlImportPlugin::pluginName() const
+{
+ return tr( "XML Import Plugin" );
+
+}
+
+
+QByteArray XmlImportPlugin::pluginVersion() const
+{
+ return "0.0.1";
+}
+
+
QString XmlImportPlugin::importActionName() const
{
return QObject::tr( "Import &XML File..." );
@@ -80,5 +100,7 @@ Account* XmlImportPlugin::importAccount(QWidget *parent) const
}
+Q_EXPORT_PLUGIN2( "XmlImportPlugin", XmlImportPlugin );
+
// kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers \
on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; \
replace-tabs on; space-indent on; // vim:set spell et sw=4 ts=4 nowrap \
cino=l1,cs,U1:
diff --git a/plugins/xml/xmlimportplugin.h b/plugins/xml/xmlimportplugin.h
index f2d731e..276f501 100644
--- a/plugins/xml/xmlimportplugin.h
+++ b/plugins/xml/xmlimportplugin.h
@@ -17,7 +17,7 @@
#ifndef XMLIMPORTPLUGIN_H
#define XMLIMPORTPLUGIN_H
-#include "interface/importplugin.h"
+#include <Knipptasch/ImportPlugin>
/**
@@ -26,10 +26,18 @@
*
* @author Stefan Böhmann <kde@hilefoks.org>
*/
-class XmlImportPlugin : public ImportPlugin
+class XmlImportPlugin : public QObject, public Knipptasch::ImportPlugin
{
+ Q_OBJECT
+ Q_INTERFACES( Knipptasch::Plugin )
+ Q_INTERFACES( Knipptasch::ImportPlugin )
+
public:
- XmlImportPlugin();
+ XmlImportPlugin(QObject *parent = 0);
+
+ QByteArray pluginIdentifier() const;
+ QString pluginName() const;
+ QByteArray pluginVersion() const;
QString importActionName() const;
QPixmap importActionIcon() const;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic