karm
csvexportdialog.cpp00001
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 grpDateRange->hide();
00045 rc.reportType = rt;
00046 break;
00047 case ReportCriteria::CSVHistoryExport:
00048 grpDateRange->setEnabled( true );
00049 rc.reportType = rt;
00050 break;
00051 default:
00052 break;
00053
00054 }
00055
00056
00057
00058 QString d = KGlobal::locale()->decimalSymbol();
00059 if ( "," == d ) CSVExportDialogBase::radioSemicolon->setChecked(true);
00060 else CSVExportDialogBase::radioComma->setChecked(true);
00061
00062 }
00063
00064 void CSVExportDialog::enableExportButton()
00065 {
00066 btnExport->setEnabled( !urlExportTo->lineEdit()->text().isEmpty() );
00067 }
00068
00069 void CSVExportDialog::enableTasksToExportQuestion()
00070 {
00071 return;
00072
00073 }
00074
00075 ReportCriteria CSVExportDialog::reportCriteria()
00076 {
00077 rc.url = urlExportTo->url();
00078 rc.from = dtFrom->date();
00079 rc.to = dtTo->date();
00080
00081
00082
00083
00084 rc.allTasks = true;
00085
00086 QString t = grpTimeFormat->selected()->name();
00087 rc.decimalMinutes = ( t == i18n( "radioDecimal" ) );
00088
00089 QString d = grpDelimiter->selected()->name();
00090 if ( d == "radioComma" ) rc.delimiter = ",";
00091 else if ( d == "radioTab" ) rc.delimiter = "\t";
00092 else if ( d == "radioSemicolon" ) rc.delimiter = ";";
00093 else if ( d == "radioSpace" ) rc.delimiter = " ";
00094 else if ( d == "radioOther" ) rc.delimiter = txtOther->text();
00095 else {
00096 kdDebug(5970)
00097 << "*** CSVExportDialog::reportCriteria: Unexpected delimiter choice '"
00098 << d << "'--defaulting to a tab" << endl;
00099 rc.delimiter = "\t";
00100 }
00101
00102 rc.quote = cboQuote->currentText();
00103
00104 return rc;
00105 }
00106
00107 #include "csvexportdialog.moc"
|