Remove some dead KMail1 legacy code.
[kdepim.git] / ktimetracker / csvexportdialog.cpp
bloba103bdeccc500273d6f304057e754d7babf73105
1 /*
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 <KDebug>
27 #include <KGlobal>
28 #include <KLocale>
29 #include <KPushButton>
30 #include <KLineEdit>
32 #include "kdateedit.h"
34 CSVExportDialog::CSVExportDialog( ReportCriteria::REPORTTYPE rt,
35 QWidget *parent
36 ) : CSVExportDialogBase( parent )
38 connect( button( User1 ), SIGNAL(clicked()),
39 this, SLOT(exPortToClipBoard()) );
40 connect( button( Ok ), SIGNAL(clicked()),
41 this, SLOT(exPortToCSVFile()) );
42 connect(urlExportTo,SIGNAL(textChanged(QString)), this, SLOT(enableExportButton()));
43 switch ( rt )
45 case ReportCriteria::CSVTotalsExport:
46 grpDateRange->setEnabled( false );
47 grpDateRange->hide();
48 rc.reportType = rt;
49 break;
50 case ReportCriteria::CSVHistoryExport:
51 grpDateRange->setEnabled( true );
52 rc.reportType = rt;
53 break;
54 default:
55 break;
58 // If decimal symbol is a comma, then default field separator to semi-colon.
59 // In France and Germany, one-and-a-half is written as 1,5 not 1.5
60 QString d = KGlobal::locale()->decimalSymbol();
61 if ( "," == d ) CSVExportDialogBase::radioSemicolon->setChecked(true);
62 else CSVExportDialogBase::radioComma->setChecked(true);
65 void CSVExportDialog::enableExportButton()
67 enableButton( Ok, !urlExportTo->lineEdit()->text().isEmpty() );
70 void CSVExportDialog::enableTasksToExportQuestion()
72 return;
73 //grpTasksToExport->setEnabled( true );
76 void CSVExportDialog::exPortToClipBoard()
78 rc.bExPortToClipBoard=true;
79 accept();
82 void CSVExportDialog::exPortToCSVFile()
84 rc.bExPortToClipBoard=false;
85 accept();
88 ReportCriteria CSVExportDialog::reportCriteria()
90 rc.url = urlExportTo->url();
91 rc.from = dtFrom->date();
92 rc.to = dtTo->date();
93 rc.decimalMinutes = ( combodecimalminutes->currentText() == i18nc( "format to display times", "Decimal" ) );
94 kDebug(5970) <<"rc.decimalMinutes is" << rc.decimalMinutes;
96 if ( radioComma->isChecked() ) rc.delimiter = ",";
97 else if ( radioTab->isChecked() ) rc.delimiter = "\t";
98 else if ( radioSemicolon->isChecked() ) rc.delimiter = ";";
99 else if ( radioSpace->isChecked() ) rc.delimiter = " ";
100 else if ( radioOther->isChecked() ) rc.delimiter = txtOther->text();
101 else
103 kDebug(5970) << "*** CSVExportDialog::reportCriteria: Unexpected delimiter choice '";
104 rc.delimiter = "\t";
107 rc.quote = cboQuote->currentText();
108 rc.sessionTimes = (i18n("Session Times") == combosessiontimes->currentText());
109 rc.allTasks = (i18n("All Tasks") == comboalltasks->currentText());
110 return rc;
113 #include "csvexportdialog.moc"