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