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