2 * Copyright (C) 2004 by Mark Bucciarelli <mark@hubcapconsulting.com>
3 * 2007 the ktimetracker developers
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the
17 * Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor
19 * Boston, MA 02110-1301 USA.
23 #include "csvexportdialog.h"
26 #include <KDateComboBox>
29 #include <KPushButton>
32 CSVExportDialog::CSVExportDialog( ReportCriteria::REPORTTYPE rt
,
34 ) : CSVExportDialogBase( parent
)
36 connect( button( User1
), SIGNAL(clicked()),
37 this, SLOT(exPortToClipBoard()) );
38 connect( button( Ok
), SIGNAL(clicked()),
39 this, SLOT(exPortToCSVFile()) );
40 connect(urlExportTo
,SIGNAL(textChanged(QString
)), this, SLOT(enableExportButton()));
43 case ReportCriteria::CSVTotalsExport
:
44 grpDateRange
->setEnabled( false );
48 case ReportCriteria::CSVHistoryExport
:
49 grpDateRange
->setEnabled( true );
56 // If decimal symbol is a comma, then default field separator to semi-colon.
57 // In France and Germany, one-and-a-half is written as 1,5 not 1.5
58 QString d
= KGlobal::locale()->decimalSymbol();
59 if ( "," == d
) CSVExportDialogBase::radioSemicolon
->setChecked(true);
60 else CSVExportDialogBase::radioComma
->setChecked(true);
63 void CSVExportDialog::enableExportButton()
65 enableButton( Ok
, !urlExportTo
->lineEdit()->text().isEmpty() );
68 void CSVExportDialog::enableTasksToExportQuestion()
71 //grpTasksToExport->setEnabled( true );
74 void CSVExportDialog::exPortToClipBoard()
76 rc
.bExPortToClipBoard
=true;
80 void CSVExportDialog::exPortToCSVFile()
82 rc
.bExPortToClipBoard
=false;
86 ReportCriteria
CSVExportDialog::reportCriteria()
88 rc
.url
= urlExportTo
->url();
89 rc
.from
= dtFrom
->date();
91 rc
.decimalMinutes
= ( combodecimalminutes
->currentText() == i18nc( "format to display times", "Decimal" ) );
92 kDebug(5970) <<"rc.decimalMinutes is" << rc
.decimalMinutes
;
94 if ( radioComma
->isChecked() ) rc
.delimiter
= ",";
95 else if ( radioTab
->isChecked() ) rc
.delimiter
= "\t";
96 else if ( radioSemicolon
->isChecked() ) rc
.delimiter
= ";";
97 else if ( radioSpace
->isChecked() ) rc
.delimiter
= " ";
98 else if ( radioOther
->isChecked() ) rc
.delimiter
= txtOther
->text();
101 kDebug(5970) << "*** CSVExportDialog::reportCriteria: Unexpected delimiter choice '";
105 rc
.quote
= cboQuote
->currentText();
106 rc
.sessionTimes
= (i18n("Session Times") == combosessiontimes
->currentText());
107 rc
.allTasks
= (i18n("All Tasks") == comboalltasks
->currentText());
111 #include "csvexportdialog.moc"