csvexportdialog.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <kdateedit.h>
00022 #include <kdebug.h>
00023 #include <kglobal.h>
00024 #include <klineedit.h>
00025 #include <klocale.h>
00026 #include <kpushbutton.h>
00027 #include <kurlrequester.h>
00028 #include <qbuttongroup.h>
00029 #include <qcombobox.h>
00030 #include <qradiobutton.h>
00031
00032 #include "csvexportdialog.h"
00033 #include "reportcriteria.h"
00034
00035 CSVExportDialog::CSVExportDialog( ReportCriteria::REPORTTYPE rt,
00036 QWidget *parent,
00037 const char *name
00038 )
00039 : CSVExportDialogBase( parent, name )
00040 {
00041 switch ( rt ) {
00042 case ReportCriteria::CSVTotalsExport:
00043 grpDateRange->setEnabled( false );
00044 rc.reportType = rt;
00045 break;
00046 case ReportCriteria::CSVHistoryExport:
00047 grpDateRange->setEnabled( true );
00048 rc.reportType = rt;
00049 break;
00050 default:
00051 break;
00052
00053 }
00054
00055
00056
00057 QString d = KGlobal::locale()->decimalSymbol();
00058 if ( "," == d ) CSVExportDialogBase::radioSemicolon->setChecked(true);
00059 else CSVExportDialogBase::radioComma->setChecked(true);
00060
00061 }
00062
00063 void CSVExportDialog::enableExportButton()
00064 {
00065 btnExport->setEnabled( !urlExportTo->lineEdit()->text().isEmpty() );
00066 }
00067
00068 void CSVExportDialog::enableTasksToExportQuestion()
00069 {
00070 return;
00071
00072 }
00073
00074 ReportCriteria CSVExportDialog::reportCriteria()
00075 {
00076 rc.url = urlExportTo->url();
00077 rc.from = dtFrom->date();
00078 rc.to = dtTo->date();
00079
00080
00081
00082
00083 rc.allTasks = true;
00084
00085 QString t = grpTimeFormat->selected()->text();
00086 rc.decimalMinutes = ( t == i18n( "Decimal" ) );
00087
00088 QString d = grpDelimiter->selected()->text();
00089 if ( d == i18n( "Comma" ) ) rc.delimiter = ",";
00090 else if ( d == i18n( "Tab" ) ) rc.delimiter = "\t";
00091 else if ( d == i18n( "Semicolon" ) ) rc.delimiter = ";";
00092 else if ( d == i18n( "Space" ) ) rc.delimiter = " ";
00093 else if ( d == i18n( "Other:" ) ) rc.delimiter = txtOther->text();
00094 else {
00095 kdDebug(5970)
00096 << "*** CSVExportDialog::reportCriteria: Unexpected delimiter choice '"
00097 << d << "'--defaulting to a tab" << endl;
00098 rc.delimiter = "\t";
00099 }
00100
00101 rc.quote = cboQuote->currentText();
00102
00103 return rc;
00104 }
00105
00106 #include "csvexportdialog.moc"
This file is part of the documentation for karm Library Version 3.3.2.