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

ktimetracker

csvexportdialog.cpp

Go to the documentation of this file.
00001 /*
00002  *     Copyright (C) 2004 by Mark Bucciarelli <mark@hubcapconsulting.com>
00003  *                   2007 the ktimetracker developers
00004  *
00005  *   This program is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License along
00016  *   with this program; if not, write to the
00017  *      Free Software Foundation, Inc.
00018  *      51 Franklin Street, Fifth Floor
00019  *      Boston, MA  02110-1301  USA.
00020  *
00021  */
00022 
00023 #include "csvexportdialog.h"
00024 
00025 
00026 #include <KDebug>
00027 #include <KGlobal>
00028 #include <KLocale>
00029 #include <KPushButton>
00030 #include <KLineEdit>
00031 
00032 #include "kdateedit.h"
00033 
00034 CSVExportDialog::CSVExportDialog( ReportCriteria::REPORTTYPE rt,
00035                                   QWidget *parent 
00036                                   ) 
00037   : CSVExportDialogBase( parent )
00038 {
00039   connect( button( User1 ), SIGNAL( clicked() ),
00040            this, SLOT( exPortToClipBoard() ) );
00041   connect( button( Ok ), SIGNAL( clicked() ),
00042            this, SLOT( exPortToCSVFile() ) );
00043   connect(urlExportTo,SIGNAL(textChanged(QString)), this, SLOT(enableExportButton()));
00044   switch ( rt ) {
00045     case ReportCriteria::CSVTotalsExport:
00046       grpDateRange->setEnabled( false );
00047       grpDateRange->hide();
00048       rc.reportType = rt;
00049       break;
00050     case ReportCriteria::CSVHistoryExport:
00051       grpDateRange->setEnabled( true );
00052       rc.reportType = rt;
00053       break;
00054     default:
00055       break;
00056 
00057   }
00058 
00059   // If decimal symbol is a comma, then default field separator to semi-colon.
00060   // In France and Germany, one-and-a-half is written as 1,5 not 1.5
00061   QString d = KGlobal::locale()->decimalSymbol();
00062   if ( "," == d ) CSVExportDialogBase::radioSemicolon->setChecked(true);
00063   else CSVExportDialogBase::radioComma->setChecked(true);
00064 
00065 }
00066 
00067 void CSVExportDialog::enableExportButton()
00068 {
00069   enableButton( Ok, !urlExportTo->lineEdit()->text().isEmpty() );
00070 }
00071 
00072 void CSVExportDialog::enableTasksToExportQuestion()
00073 {
00074   return;
00075   //grpTasksToExport->setEnabled( true );      
00076 }
00077 
00078 void CSVExportDialog::exPortToClipBoard()
00079 {
00080   rc.bExPortToClipBoard=true;
00081   accept();
00082 }
00083 
00084 void CSVExportDialog::exPortToCSVFile()
00085 {
00086   rc.bExPortToClipBoard=false;
00087   accept();
00088 }
00089 
00090 ReportCriteria CSVExportDialog::reportCriteria()
00091 {
00092   rc.url = urlExportTo->url();
00093   rc.from = dtFrom->date();
00094   rc.to = dtTo->date();
00095   rc.decimalMinutes = (  combodecimalminutes->currentText() == i18nc( "format to display times", "Decimal" ) );
00096   kDebug(5970) <<"rc.decimalMinutes is" << rc.decimalMinutes;
00097 
00098   if ( radioComma->isChecked() )          rc.delimiter = ",";
00099   else if ( radioTab->isChecked() )       rc.delimiter = "\t";
00100   else if ( radioSemicolon->isChecked() ) rc.delimiter = ";";
00101   else if ( radioSpace->isChecked() )     rc.delimiter = " ";
00102   else if ( radioOther->isChecked() )     rc.delimiter = txtOther->text();
00103   else {
00104     kDebug(5970) 
00105         << "*** CSVExportDialog::reportCriteria: Unexpected delimiter choice '";
00106     rc.delimiter = "\t";
00107   }
00108 
00109   rc.quote = cboQuote->currentText();
00110   rc.sessionTimes = (i18n("Session Times") == combosessiontimes->currentText());
00111   rc.allTasks = (i18n("All Tasks") == comboalltasks->currentText());
00112 
00113   return rc;
00114 }
00115 
00116 #include "csvexportdialog.moc"

ktimetracker

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal