00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "csvexportdialog_base.h"
00013
00014 #include <qvariant.h>
00015 #include <kdateedit.h>
00016 #include <qpushbutton.h>
00017 #include <kpushbutton.h>
00018 #include <qlabel.h>
00019 #include <kurlrequester.h>
00020 #include <qbuttongroup.h>
00021 #include <qradiobutton.h>
00022 #include <qlineedit.h>
00023 #include <qgroupbox.h>
00024 #include <qcombobox.h>
00025 #include <qlayout.h>
00026 #include <qtooltip.h>
00027 #include <qwhatsthis.h>
00028
00029
00030
00031
00032
00033
00034
00035
00036 CSVExportDialogBase::CSVExportDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl )
00037 : QDialog( parent, name, modal, fl )
00038 {
00039 if ( !name )
00040 setName( "CSVExportDialogBase" );
00041
00042 QWidget* privateLayoutWidget = new QWidget( this, "layout5" );
00043 privateLayoutWidget->setGeometry( QRect( 10, 16, 323, 372 ) );
00044 layout5 = new QGridLayout( privateLayoutWidget, 1, 1, 11, 6, "layout5");
00045
00046 layout22 = new QHBoxLayout( 0, 0, 6, "layout22");
00047 spacer1 = new QSpacerItem( 140, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00048 layout22->addItem( spacer1 );
00049
00050 btnExport = new KPushButton( privateLayoutWidget, "btnExport" );
00051 btnExport->setEnabled( FALSE );
00052 btnExport->setDefault( TRUE );
00053 layout22->addWidget( btnExport );
00054
00055 btnCancel = new KPushButton( privateLayoutWidget, "btnCancel" );
00056 layout22->addWidget( btnCancel );
00057
00058 layout5->addLayout( layout22, 6, 0 );
00059
00060 layout1 = new QHBoxLayout( 0, 0, 6, "layout1");
00061
00062 textLabel1_3 = new QLabel( privateLayoutWidget, "textLabel1_3" );
00063 layout1->addWidget( textLabel1_3 );
00064
00065 urlExportTo = new KURLRequester( privateLayoutWidget, "urlExportTo" );
00066 layout1->addWidget( urlExportTo );
00067
00068 layout5->addLayout( layout1, 0, 0 );
00069
00070 grpTimeFormat = new QButtonGroup( privateLayoutWidget, "grpTimeFormat" );
00071
00072 radioHoursMinutes = new QRadioButton( grpTimeFormat, "radioHoursMinutes" );
00073 radioHoursMinutes->setGeometry( QRect( 105, 21, 105, 19 ) );
00074 radioHoursMinutes->setFocusPolicy( QRadioButton::NoFocus );
00075
00076 radioDecimal = new QRadioButton( grpTimeFormat, "radioDecimal" );
00077 radioDecimal->setGeometry( QRect( 31, 21, 68, 19 ) );
00078 radioDecimal->setChecked( TRUE );
00079
00080 layout5->addWidget( grpTimeFormat, 2, 0 );
00081
00082 grpDelimiter = new QButtonGroup( privateLayoutWidget, "grpDelimiter" );
00083 grpDelimiter->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, grpDelimiter->sizePolicy().hasHeightForWidth() ) );
00084
00085 radioTab = new QRadioButton( grpDelimiter, "radioTab" );
00086 radioTab->setGeometry( QRect( 30, 46, 67, 19 ) );
00087
00088 radioOther = new QRadioButton( grpDelimiter, "radioOther" );
00089 radioOther->setGeometry( QRect( 191, 20, 59, 19 ) );
00090
00091 radioSpace = new QRadioButton( grpDelimiter, "radioSpace" );
00092 radioSpace->setGeometry( QRect( 103, 46, 82, 19 ) );
00093
00094 radioComma = new QRadioButton( grpDelimiter, "radioComma" );
00095 radioComma->setGeometry( QRect( 30, 20, 67, 19 ) );
00096 radioComma->setChecked( TRUE );
00097
00098 txtOther = new QLineEdit( grpDelimiter, "txtOther" );
00099 txtOther->setEnabled( FALSE );
00100 txtOther->setGeometry( QRect( 191, 45, 30, 21 ) );
00101 txtOther->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, txtOther->sizePolicy().hasHeightForWidth() ) );
00102 txtOther->setMaximumSize( QSize( 30, 32767 ) );
00103 txtOther->setFocusPolicy( QLineEdit::StrongFocus );
00104 txtOther->setMaxLength( 1 );
00105
00106 radioSemicolon = new QRadioButton( grpDelimiter, "radioSemicolon" );
00107 radioSemicolon->setGeometry( QRect( 103, 20, 82, 19 ) );
00108
00109 layout5->addWidget( grpDelimiter, 3, 0 );
00110 spacer3 = new QSpacerItem( 20, 30, QSizePolicy::Minimum, QSizePolicy::Expanding );
00111 layout5->addItem( spacer3, 5, 0 );
00112
00113 grpDateRange = new QGroupBox( privateLayoutWidget, "grpDateRange" );
00114 grpDateRange->setEnabled( FALSE );
00115
00116 textLabel1 = new QLabel( grpDateRange, "textLabel1" );
00117 textLabel1->setGeometry( QRect( 30, 20, 33, 21 ) );
00118
00119 dtFrom = new KDateEdit( grpDateRange, "dtFrom" );
00120 dtFrom->setGeometry( QRect( 30, 40, 95, 21 ) );
00121 dtFrom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, dtFrom->sizePolicy().hasHeightForWidth() ) );
00122 dtFrom->setFocusPolicy( KDateEdit::StrongFocus );
00123
00124 textLabel1_2 = new QLabel( grpDateRange, "textLabel1_2" );
00125 textLabel1_2->setGeometry( QRect( 170, 20, 18, 21 ) );
00126
00127 dtTo = new KDateEdit( grpDateRange, "dtTo" );
00128 dtTo->setGeometry( QRect( 170, 40, 95, 21 ) );
00129 dtTo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, dtTo->sizePolicy().hasHeightForWidth() ) );
00130 dtTo->setFocusPolicy( KDateEdit::StrongFocus );
00131
00132 layout5->addWidget( grpDateRange, 1, 0 );
00133
00134 layout3 = new QHBoxLayout( 0, 0, 6, "layout3");
00135
00136 quotesLabel = new QLabel( privateLayoutWidget, "quotesLabel" );
00137 quotesLabel->setEnabled( TRUE );
00138 quotesLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, quotesLabel->sizePolicy().hasHeightForWidth() ) );
00139 layout3->addWidget( quotesLabel );
00140
00141 cboQuote = new QComboBox( FALSE, privateLayoutWidget, "cboQuote" );
00142 cboQuote->setEnabled( TRUE );
00143 cboQuote->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, cboQuote->sizePolicy().hasHeightForWidth() ) );
00144 layout3->addWidget( cboQuote );
00145
00146 layout5->addLayout( layout3, 4, 0 );
00147 languageChange();
00148 resize( QSize(343, 410).expandedTo(minimumSizeHint()) );
00149 clearWState( WState_Polished );
00150
00151
00152 connect( btnCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
00153 connect( radioOther, SIGNAL( toggled(bool) ), txtOther, SLOT( setEnabled(bool) ) );
00154 connect( btnExport, SIGNAL( clicked() ), this, SLOT( accept() ) );
00155 connect( urlExportTo, SIGNAL( textChanged(const QString&) ), this, SLOT( enableExportButton() ) );
00156
00157
00158 setTabOrder( urlExportTo, dtFrom );
00159 setTabOrder( dtFrom, dtTo );
00160 setTabOrder( dtTo, radioDecimal );
00161 setTabOrder( radioDecimal, radioComma );
00162 setTabOrder( radioComma, txtOther );
00163 setTabOrder( txtOther, cboQuote );
00164 setTabOrder( cboQuote, btnExport );
00165 setTabOrder( btnExport, btnCancel );
00166 }
00167
00168
00169
00170
00171 CSVExportDialogBase::~CSVExportDialogBase()
00172 {
00173
00174 }
00175
00176
00177
00178
00179
00180 void CSVExportDialogBase::languageChange()
00181 {
00182 setCaption( tr2i18n( "CSV Export" ) );
00183 btnExport->setText( tr2i18n( "&Export" ) );
00184 btnCancel->setText( tr2i18n( "&Cancel" ) );
00185 textLabel1_3->setText( tr2i18n( "Export to:" ) );
00186 QWhatsThis::add( urlExportTo, tr2i18n( "The file where Karm will write the data." ) );
00187 grpTimeFormat->setTitle( tr2i18n( "Time Format" ) );
00188 QWhatsThis::add( grpTimeFormat, tr2i18n( "<p>You can choose to output time values in fractions of an hour or in minutes.</p>\n"
00189 "<p>For example, if the value is 5 hours and 45 minutes, then the Decimal option would output <tt>5.75</tt>, and the Hours:Minutes option would output <tt>5.5</tt></p>" ) );
00190 radioHoursMinutes->setText( tr2i18n( "Hours:Minutes" ) );
00191 radioDecimal->setText( tr2i18n( "Decimal" ) );
00192 grpDelimiter->setTitle( tr2i18n( "Delimiter" ) );
00193 QWhatsThis::add( grpDelimiter, tr2i18n( "The character used to seperate one field from another in the output." ) );
00194 radioTab->setText( tr2i18n( "Tab" ) );
00195 radioOther->setText( tr2i18n( "Other:" ) );
00196 radioSpace->setText( tr2i18n( "Space" ) );
00197 radioComma->setText( tr2i18n( "Comma" ) );
00198 radioSemicolon->setText( tr2i18n( "Semicolon" ) );
00199 grpDateRange->setTitle( tr2i18n( "Date Range" ) );
00200 QWhatsThis::add( grpDateRange, tr2i18n( "<p>An inclusive date range for reporting on time card history. Not enabled when reporting on totals.</p>" ) );
00201 textLabel1->setText( tr2i18n( "From:" ) );
00202 textLabel1_2->setText( tr2i18n( "To:" ) );
00203 quotesLabel->setText( tr2i18n( "Quotes:" ) );
00204 cboQuote->clear();
00205 cboQuote->insertItem( tr2i18n( "\"" ) );
00206 cboQuote->insertItem( tr2i18n( "'" ) );
00207 QWhatsThis::add( cboQuote, tr2i18n( "All fields are quoted in the output." ) );
00208 }
00209
00210 void CSVExportDialogBase::enableExportButton()
00211 {
00212 qWarning( "CSVExportDialogBase::enableExportButton(): Not implemented yet" );
00213 }
00214
00215 #include "csvexportdialog_base.moc"