karm

csvexportdialog_base.cpp

00001 #include <kdialog.h>
00002 #include <klocale.h>
00003 /****************************************************************************
00004 ** Form implementation generated from reading ui file './csvexportdialog_base.ui'
00005 **
00006 ** Created: Thu Mar 29 06:23:36 2007
00007 **      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.8   edited Jan 11 14:47 $)
00008 **
00009 ** WARNING! All changes made in this file will be lost!
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 <qcombobox.h>
00021 #include <qgroupbox.h>
00022 #include <qbuttongroup.h>
00023 #include <qradiobutton.h>
00024 #include <qlineedit.h>
00025 #include <qlayout.h>
00026 #include <qtooltip.h>
00027 #include <qwhatsthis.h>
00028 #include "kdateedit.h"
00029 
00030 /*
00031  *  Constructs a CSVExportDialogBase as a child of 'parent', with the
00032  *  name 'name' and widget flags set to 'f'.
00033  *
00034  *  The dialog will by default be modeless, unless you set 'modal' to
00035  *  TRUE to construct a modal dialog.
00036  */
00037 CSVExportDialogBase::CSVExportDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl )
00038     : QDialog( parent, name, modal, fl )
00039 {
00040     if ( !name )
00041     setName( "CSVExportDialogBase" );
00042     CSVExportDialogBaseLayout = new QGridLayout( this, 1, 1, 11, 6, "CSVExportDialogBaseLayout"); 
00043     spacer3 = new QSpacerItem( 20, 29, QSizePolicy::Minimum, QSizePolicy::Expanding );
00044     CSVExportDialogBaseLayout->addMultiCell( spacer3, 5, 5, 1, 2 );
00045     spacer1 = new QSpacerItem( 160, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00046     CSVExportDialogBaseLayout->addMultiCell( spacer1, 6, 6, 0, 1 );
00047 
00048     btnExport = new KPushButton( this, "btnExport" );
00049     btnExport->setEnabled( FALSE );
00050     btnExport->setDefault( TRUE );
00051 
00052     CSVExportDialogBaseLayout->addWidget( btnExport, 6, 2 );
00053 
00054     btnCancel = new KPushButton( this, "btnCancel" );
00055 
00056     CSVExportDialogBaseLayout->addWidget( btnCancel, 6, 3 );
00057 
00058     textLabel1_3 = new QLabel( this, "textLabel1_3" );
00059 
00060     CSVExportDialogBaseLayout->addWidget( textLabel1_3, 0, 0 );
00061 
00062     urlExportTo = new KURLRequester( this, "urlExportTo" );
00063 
00064     CSVExportDialogBaseLayout->addMultiCellWidget( urlExportTo, 0, 0, 1, 3 );
00065 
00066     quotesLabel = new QLabel( this, "quotesLabel" );
00067     quotesLabel->setEnabled( TRUE );
00068     quotesLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, quotesLabel->sizePolicy().hasHeightForWidth() ) );
00069 
00070     CSVExportDialogBaseLayout->addMultiCellWidget( quotesLabel, 4, 4, 0, 1 );
00071 
00072     cboQuote = new QComboBox( FALSE, this, "cboQuote" );
00073     cboQuote->setEnabled( TRUE );
00074     cboQuote->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, cboQuote->sizePolicy().hasHeightForWidth() ) );
00075 
00076     CSVExportDialogBaseLayout->addMultiCellWidget( cboQuote, 4, 4, 2, 3 );
00077 
00078     grpDateRange = new QGroupBox( this, "grpDateRange" );
00079     grpDateRange->setEnabled( FALSE );
00080     grpDateRange->setColumnLayout(0, Qt::Vertical );
00081     grpDateRange->layout()->setSpacing( 6 );
00082     grpDateRange->layout()->setMargin( 11 );
00083     grpDateRangeLayout = new QGridLayout( grpDateRange->layout() );
00084     grpDateRangeLayout->setAlignment( Qt::AlignTop );
00085 
00086     textLabel1 = new QLabel( grpDateRange, "textLabel1" );
00087 
00088     grpDateRangeLayout->addWidget( textLabel1, 0, 0 );
00089 
00090     dtFrom = new KDateEdit( grpDateRange, "dtFrom" );
00091     dtFrom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, dtFrom->sizePolicy().hasHeightForWidth() ) );
00092     dtFrom->setFocusPolicy( KDateEdit::StrongFocus );
00093 
00094     grpDateRangeLayout->addWidget( dtFrom, 1, 0 );
00095 
00096     textLabel1_2 = new QLabel( grpDateRange, "textLabel1_2" );
00097 
00098     grpDateRangeLayout->addWidget( textLabel1_2, 0, 1 );
00099 
00100     dtTo = new KDateEdit( grpDateRange, "dtTo" );
00101     dtTo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, dtTo->sizePolicy().hasHeightForWidth() ) );
00102     dtTo->setFocusPolicy( KDateEdit::StrongFocus );
00103 
00104     grpDateRangeLayout->addWidget( dtTo, 1, 1 );
00105 
00106     CSVExportDialogBaseLayout->addMultiCellWidget( grpDateRange, 1, 1, 0, 3 );
00107 
00108     grpTimeFormat = new QButtonGroup( this, "grpTimeFormat" );
00109     grpTimeFormat->setColumnLayout(0, Qt::Vertical );
00110     grpTimeFormat->layout()->setSpacing( 6 );
00111     grpTimeFormat->layout()->setMargin( 11 );
00112     grpTimeFormatLayout = new QGridLayout( grpTimeFormat->layout() );
00113     grpTimeFormatLayout->setAlignment( Qt::AlignTop );
00114 
00115     radioHoursMinutes = new QRadioButton( grpTimeFormat, "radioHoursMinutes" );
00116     radioHoursMinutes->setFocusPolicy( QRadioButton::NoFocus );
00117 
00118     grpTimeFormatLayout->addWidget( radioHoursMinutes, 0, 1 );
00119 
00120     radioDecimal = new QRadioButton( grpTimeFormat, "radioDecimal" );
00121     radioDecimal->setChecked( TRUE );
00122 
00123     grpTimeFormatLayout->addWidget( radioDecimal, 0, 0 );
00124 
00125     CSVExportDialogBaseLayout->addMultiCellWidget( grpTimeFormat, 2, 2, 0, 3 );
00126 
00127     grpDelimiter = new QButtonGroup( this, "grpDelimiter" );
00128     grpDelimiter->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, grpDelimiter->sizePolicy().hasHeightForWidth() ) );
00129     grpDelimiter->setColumnLayout(0, Qt::Vertical );
00130     grpDelimiter->layout()->setSpacing( 6 );
00131     grpDelimiter->layout()->setMargin( 11 );
00132     grpDelimiterLayout = new QGridLayout( grpDelimiter->layout() );
00133     grpDelimiterLayout->setAlignment( Qt::AlignTop );
00134 
00135     radioTab = new QRadioButton( grpDelimiter, "radioTab" );
00136 
00137     grpDelimiterLayout->addWidget( radioTab, 1, 0 );
00138 
00139     radioOther = new QRadioButton( grpDelimiter, "radioOther" );
00140 
00141     grpDelimiterLayout->addWidget( radioOther, 0, 2 );
00142 
00143     radioSpace = new QRadioButton( grpDelimiter, "radioSpace" );
00144 
00145     grpDelimiterLayout->addWidget( radioSpace, 1, 1 );
00146 
00147     radioComma = new QRadioButton( grpDelimiter, "radioComma" );
00148     radioComma->setChecked( TRUE );
00149 
00150     grpDelimiterLayout->addWidget( radioComma, 0, 0 );
00151 
00152     txtOther = new QLineEdit( grpDelimiter, "txtOther" );
00153     txtOther->setEnabled( FALSE );
00154     txtOther->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, txtOther->sizePolicy().hasHeightForWidth() ) );
00155     txtOther->setMaximumSize( QSize( 30, 32767 ) );
00156     txtOther->setFocusPolicy( QLineEdit::StrongFocus );
00157     txtOther->setMaxLength( 1 );
00158 
00159     grpDelimiterLayout->addWidget( txtOther, 1, 2 );
00160 
00161     radioSemicolon = new QRadioButton( grpDelimiter, "radioSemicolon" );
00162 
00163     grpDelimiterLayout->addWidget( radioSemicolon, 0, 1 );
00164 
00165     CSVExportDialogBaseLayout->addMultiCellWidget( grpDelimiter, 3, 3, 0, 3 );
00166     languageChange();
00167     resize( QSize(343, 361).expandedTo(minimumSizeHint()) );
00168     clearWState( WState_Polished );
00169 
00170     // signals and slots connections
00171     connect( btnCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
00172     connect( radioOther, SIGNAL( toggled(bool) ), txtOther, SLOT( setEnabled(bool) ) );
00173     connect( btnExport, SIGNAL( clicked() ), this, SLOT( accept() ) );
00174     connect( urlExportTo, SIGNAL( textChanged(const QString&) ), this, SLOT( enableExportButton() ) );
00175 
00176     // tab order
00177     setTabOrder( urlExportTo, dtFrom );
00178     setTabOrder( dtFrom, dtTo );
00179     setTabOrder( dtTo, radioDecimal );
00180     setTabOrder( radioDecimal, radioComma );
00181     setTabOrder( radioComma, txtOther );
00182     setTabOrder( txtOther, cboQuote );
00183     setTabOrder( cboQuote, btnExport );
00184     setTabOrder( btnExport, btnCancel );
00185 }
00186 
00187 /*
00188  *  Destroys the object and frees any allocated resources
00189  */
00190 CSVExportDialogBase::~CSVExportDialogBase()
00191 {
00192     // no need to delete child widgets, Qt does it all for us
00193 }
00194 
00195 /*
00196  *  Sets the strings of the subwidgets using the current
00197  *  language.
00198  */
00199 void CSVExportDialogBase::languageChange()
00200 {
00201     setCaption( tr2i18n( "CSV Export" ) );
00202     btnExport->setText( tr2i18n( "&Export" ) );
00203     btnCancel->setText( tr2i18n( "&Cancel" ) );
00204     textLabel1_3->setText( tr2i18n( "Export to:" ) );
00205     QWhatsThis::add( urlExportTo, tr2i18n( "The file where Karm will write the data." ) );
00206     quotesLabel->setText( tr2i18n( "Quotes:" ) );
00207     cboQuote->clear();
00208     cboQuote->insertItem( tr2i18n( "\"" ) );
00209     cboQuote->insertItem( tr2i18n( "'" ) );
00210     QWhatsThis::add( cboQuote, tr2i18n( "All fields are quoted in the output." ) );
00211     grpDateRange->setTitle( tr2i18n( "Date Range" ) );
00212     QWhatsThis::add( grpDateRange, tr2i18n( "<p>An inclusive date range for reporting on time card history.  Not enabled when reporting on totals.</p>" ) );
00213     textLabel1->setText( tr2i18n( "From:" ) );
00214     textLabel1_2->setText( tr2i18n( "To:" ) );
00215     grpTimeFormat->setTitle( tr2i18n( "Time Format" ) );
00216     QWhatsThis::add( grpTimeFormat, tr2i18n( "<p>You can choose to output time values in fractions of an hour or in minutes.</p>\n"
00217 "<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:45</tt></p>" ) );
00218     radioHoursMinutes->setText( tr2i18n( "Hours:Minutes" ) );
00219     radioDecimal->setText( tr2i18n( "Decimal" ) );
00220     grpDelimiter->setTitle( tr2i18n( "Delimiter" ) );
00221     QWhatsThis::add( grpDelimiter, tr2i18n( "The character used to seperate one field from another in the output." ) );
00222     radioTab->setText( tr2i18n( "Tab" ) );
00223     radioOther->setText( tr2i18n( "Other:" ) );
00224     radioSpace->setText( tr2i18n( "Space" ) );
00225     radioComma->setText( tr2i18n( "Comma" ) );
00226     radioSemicolon->setText( tr2i18n( "Semicolon" ) );
00227 }
00228 
00229 void CSVExportDialogBase::enableExportButton()
00230 {
00231     qWarning( "CSVExportDialogBase::enableExportButton(): Not implemented yet" );
00232 }
00233 
00234 #include "csvexportdialog_base.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys