filters
exportdialog.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qcheckbox.h>
00021 #include <qcombobox.h>
00022 #include <qlistbox.h>
00023 #include <qradiobutton.h>
00024 #include <qspinbox.h>
00025 #include <qtextcodec.h>
00026
00027 #include <kapplication.h>
00028 #include <kglobal.h>
00029 #include <klocale.h>
00030 #include <kurlrequester.h>
00031
00032 #include <exportdialog.h>
00033 #include <exportwidget.h>
00034
00035 ExportDialog::ExportDialog( QWidget *parent, const char *name )
00036 : KDialogBase( parent, name, true, i18n("Export Sheet to HTML"), Ok|Cancel, No, true ), m_mainwidget( new ExportWidget( this ) )
00037 {
00038 kapp->restoreOverrideCursor();
00039
00040 connect( m_mainwidget->mCustomButton, SIGNAL( toggled( bool ) ),
00041 m_mainwidget->mCustomURL, SLOT( setEnabled( bool ) ) );
00042 connect( m_mainwidget->mSelectAllButton, SIGNAL( clicked() ), SLOT( selectAll() ) );
00043 connect( m_mainwidget->mDeselectAllButton, SIGNAL( clicked() ),
00044 m_mainwidget->mSheets, SLOT( clearSelection() ) );
00045
00046 m_mainwidget->mEncodingBox->insertItem( i18n( "Recommended: UTF-8" ) );
00047 m_mainwidget->mEncodingBox->insertItem( i18n( "Locale (%1)" ).arg( KGlobal::locale()->codecForEncoding()->name() ) );
00048
00049 m_mainwidget->mCustomURL->setMode( KFile::ExistingOnly );
00050
00051 setMainWidget( m_mainwidget );
00052 }
00053
00054 void ExportDialog::selectAll()
00055 {
00056 m_mainwidget->mSheets->selectAll( true );
00057 }
00058
00059 ExportDialog::~ExportDialog()
00060 {
00061 kapp->setOverrideCursor(Qt::waitCursor);
00062 }
00063
00064 QTextCodec *ExportDialog::encoding() const
00065 {
00066 if( m_mainwidget->mEncodingBox->currentItem() == 1 )
00067 return KGlobal::locale()->codecForEncoding();
00068
00069 return QTextCodec::codecForName( "utf8" );
00070 }
00071
00072 bool ExportDialog::useBorders() const
00073 {
00074 return m_mainwidget->mUseBorders->isChecked();
00075 }
00076
00077 bool ExportDialog::separateFiles() const
00078 {
00079 return m_mainwidget->mSeparateFiles->isChecked();
00080 }
00081
00082 QString ExportDialog::customStyleURL() const
00083 {
00084 QString url = m_mainwidget->mCustomURL->url();
00085 if( m_mainwidget->mCustomButton->isChecked() && KURL( url ).isValid() )
00086 return url;
00087
00088 return QString::null;
00089 }
00090
00091 void ExportDialog::setSheets( const QStringList &list )
00092 {
00093 m_mainwidget->mSheets->insertStringList( list );
00094 selectAll();
00095 }
00096
00097 QStringList ExportDialog::sheets() const
00098 {
00099 QStringList list;
00100 for( uint i = 0; i < m_mainwidget->mSheets->count() ; i++ )
00101 {
00102 if( m_mainwidget->mSheets->isSelected( i ) )
00103 list.append( m_mainwidget->mSheets->text( i ) );
00104 }
00105 return list;
00106 }
00107
00108 int ExportDialog::pixelsBetweenCells() const
00109 {
00110 return m_mainwidget->mPixelsBetweenCells->value();
00111 }
00112
00113 #include <exportdialog.moc>
|