• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

ktimetracker

  • sources
  • kde-4.12
  • kdepim
  • ktimetracker
csvexportdialog.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004 by Mark Bucciarelli <mark@hubcapconsulting.com>
3  * 2007 the ktimetracker developers
4  *
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.
9  *
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.
14  *
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.
20  *
21  */
22 
23 #include "csvexportdialog.h"
24 
25 #include <KDebug>
26 #include <KDateComboBox>
27 #include <KGlobal>
28 #include <KLocale>
29 #include <KPushButton>
30 #include <KLineEdit>
31 
32 CSVExportDialog::CSVExportDialog( ReportCriteria::REPORTTYPE rt,
33  QWidget *parent
34  ) : CSVExportDialogBase( parent )
35 {
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()));
41  switch ( rt )
42  {
43  case ReportCriteria::CSVTotalsExport:
44  grpDateRange->setEnabled( false );
45  grpDateRange->hide();
46  rc.reportType = rt;
47  break;
48  case ReportCriteria::CSVHistoryExport:
49  grpDateRange->setEnabled( true );
50  rc.reportType = rt;
51  break;
52  default:
53  break;
54  }
55 
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);
61 }
62 
63 void CSVExportDialog::enableExportButton()
64 {
65  enableButton( Ok, !urlExportTo->lineEdit()->text().isEmpty() );
66 }
67 
68 void CSVExportDialog::enableTasksToExportQuestion()
69 {
70  return;
71  //grpTasksToExport->setEnabled( true );
72 }
73 
74 void CSVExportDialog::exPortToClipBoard()
75 {
76  rc.bExPortToClipBoard=true;
77  accept();
78 }
79 
80 void CSVExportDialog::exPortToCSVFile()
81 {
82  rc.bExPortToClipBoard=false;
83  accept();
84 }
85 
86 ReportCriteria CSVExportDialog::reportCriteria()
87 {
88  rc.url = urlExportTo->url();
89  rc.from = dtFrom->date();
90  rc.to = dtTo->date();
91  rc.decimalMinutes = ( combodecimalminutes->currentText() == i18nc( "format to display times", "Decimal" ) );
92  kDebug(5970) <<"rc.decimalMinutes is" << rc.decimalMinutes;
93 
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();
99  else
100  {
101  kDebug(5970) << "*** CSVExportDialog::reportCriteria: Unexpected delimiter choice '";
102  rc.delimiter = "\t";
103  }
104 
105  rc.quote = cboQuote->currentText();
106  rc.sessionTimes = (i18n("Session Times") == combosessiontimes->currentText());
107  rc.allTasks = (i18n("All Tasks") == comboalltasks->currentText());
108  return rc;
109 }
110 
111 #include "csvexportdialog.moc"
ReportCriteria::from
QDate from
For history reports, the lower bound of the date range to report on.
Definition: reportcriteria.h:63
ReportCriteria::quote
QString quote
The quote to use for text fields when outputting comma-separated reports.
Definition: reportcriteria.h:99
ReportCriteria::url
KUrl url
For reports that write to a file, the filename to write to.
Definition: reportcriteria.h:58
QWidget
ReportCriteria::delimiter
QString delimiter
The delimiter to use when outputting comma-separated value reports.
Definition: reportcriteria.h:94
CSVExportDialog::reportCriteria
ReportCriteria reportCriteria()
Return an object that encapsulates the choices the user has made.
Definition: csvexportdialog.cpp:86
ReportCriteria::reportType
REPORTTYPE reportType
The type of report we are running.
Definition: reportcriteria.h:53
csvexportdialog.h
ReportCriteria
Stores entries from export dialog.
Definition: reportcriteria.h:41
ReportCriteria::CSVTotalsExport
Definition: reportcriteria.h:48
CSVExportDialog::exPortToCSVFile
void exPortToCSVFile()
Definition: csvexportdialog.cpp:80
CSVExportDialog::CSVExportDialog
CSVExportDialog(ReportCriteria::REPORTTYPE rt, QWidget *parent=0)
Definition: csvexportdialog.cpp:32
ReportCriteria::bExPortToClipBoard
bool bExPortToClipBoard
True if a clipboard export is wished, not an export to a file.
Definition: reportcriteria.h:89
ReportCriteria::CSVHistoryExport
Definition: reportcriteria.h:48
ReportCriteria::decimalMinutes
bool decimalMinutes
True if the durations should be output in decimal hours.
Definition: reportcriteria.h:74
ReportCriteria::allTasks
bool allTasks
True if user chose to export all tasks, not only the selected one.
Definition: reportcriteria.h:84
ReportCriteria::REPORTTYPE
REPORTTYPE
The different report types.
Definition: reportcriteria.h:48
CSVExportDialogBase
Definition: csvexportdialog.h:29
CSVExportDialog::enableTasksToExportQuestion
void enableTasksToExportQuestion()
Enable the "Tasks to export" question in the dialog.
Definition: csvexportdialog.cpp:68
ReportCriteria::to
QDate to
For history reports, the upper bound of the date range to report on.
Definition: reportcriteria.h:68
CSVExportDialog::exPortToClipBoard
void exPortToClipBoard()
Definition: csvexportdialog.cpp:74
ReportCriteria::sessionTimes
bool sessionTimes
True if user chose to export session times, not all times.
Definition: reportcriteria.h:79
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktimetracker

Skip menu "ktimetracker"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal