kpilot
doc-setup.ccGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "options.h"
00030
00031 #include <qtabwidget.h>
00032 #include <qcheckbox.h>
00033 #include <qbuttongroup.h>
00034 #include <qcombobox.h>
00035
00036 #include <kconfig.h>
00037 #include <kurlrequester.h>
00038 #include <kcharsets.h>
00039
00040 #include "doc-setupdialog.h"
00041 #include "doc-factory.h"
00042 #include "doc-setup.h"
00043 #include "docconduitSettings.h"
00044
00045
00046 DOCWidgetConfig::DOCWidgetConfig(QWidget * w, const char *n):
00047 ConduitConfigBase(w, n),
00048 fConfigWidget(new DOCWidget(w))
00049 {
00050 FUNCTIONSETUP;
00051
00052 fWidget=fConfigWidget;
00053
00054 QStringList l = KGlobal::charsets()->descriptiveEncodingNames();
00055 for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it)
00056 {
00057 fConfigWidget->fEncoding->insertItem(*it);
00058 }
00059
00060 fConfigWidget->fTXTDir->setMode(KFile::Directory);
00061 fConfigWidget->fPDBDir->setMode(KFile::Directory);
00062 ConduitConfigBase::addAboutPage(fConfigWidget->tabWidget,DOCConduitFactory::about());
00063
00064 fConduitName=i18n("Palm DOC");
00065
00066 #define CMOD(a,b) connect(fConfigWidget->a,SIGNAL(b),this,SLOT(modified()))
00067 CMOD(fTXTDir,textChanged(const QString &));
00068 CMOD(fPDBDir,textChanged(const QString &));
00069 CMOD(fkeepPDBLocally,clicked());
00070 CMOD(fConflictResolution,clicked(int));
00071 CMOD(fConvertBookmarks,stateChanged(int));
00072 CMOD(fBookmarksBmk,stateChanged(int));
00073 CMOD(fBookmarksInline,stateChanged(int));
00074 CMOD(fBookmarksEndtags,stateChanged(int));
00075 CMOD(fCompress,stateChanged(int));
00076 CMOD(fSyncDirection,clicked(int));
00077 CMOD(fNoConversionOfBmksOnly,stateChanged(int));
00078 CMOD(fAlwaysUseResolution,stateChanged(int));
00079 CMOD(fPCBookmarks,clicked(int));
00080 CMOD(fEncoding,textChanged(const QString &));
00081 #undef CMOD
00082
00083 fConfigWidget->adjustSize();
00084 }
00085
00086 void DOCWidgetConfig::commit()
00087 {
00088 FUNCTIONSETUP;
00089
00090 DOCConduitSettings::setTXTDirectory( fConfigWidget->fTXTDir->url() );
00091 DOCConduitSettings::setPDBDirectory( fConfigWidget->fPDBDir->url() );
00092
00093 DOCConduitSettings::setKeepPDBsLocally( fConfigWidget->fkeepPDBLocally->isChecked());
00094 DOCConduitSettings::setConflictResolution( fConfigWidget->fConflictResolution->id(
00095 fConfigWidget->fConflictResolution->selected()) );
00096 DOCConduitSettings::setConvertBookmarks(fConfigWidget->fConvertBookmarks->isChecked());
00097 DOCConduitSettings::setBmkFileBookmarks(fConfigWidget->fBookmarksBmk->isChecked());
00098 DOCConduitSettings::setInlineBookmarks(fConfigWidget->fBookmarksInline->isChecked());
00099 DOCConduitSettings::setEndtagBookmarks(fConfigWidget->fBookmarksEndtags->isChecked());
00100 DOCConduitSettings::setCompress(fConfigWidget->fCompress->isChecked());
00101 DOCConduitSettings::setSyncDirection(fConfigWidget->fSyncDirection->id(
00102 fConfigWidget->fSyncDirection->selected()));
00103 DOCConduitSettings::setIgnoreBmkChanges(fConfigWidget->fNoConversionOfBmksOnly->isChecked());
00104 DOCConduitSettings::setAlwaysShowResolutionDialog(fConfigWidget->fAlwaysUseResolution->isChecked());
00105 DOCConduitSettings::setBookmarksToPC( fConfigWidget->fPCBookmarks->id(
00106 fConfigWidget->fPCBookmarks->selected()) );
00107 DOCConduitSettings::setEncoding( fConfigWidget->fEncoding->currentText() );
00108
00109 DOCConduitSettings::self()->writeConfig();
00110 unmodified();
00111 }
00112
00113 void DOCWidgetConfig::load()
00114 {
00115 FUNCTIONSETUP;
00116 DOCConduitSettings::self()->readConfig();
00117
00118 fConfigWidget->fTXTDir->setURL( DOCConduitSettings::tXTDirectory() );
00119 fConfigWidget->fPDBDir->setURL( DOCConduitSettings::pDBDirectory() );
00120 fConfigWidget->fkeepPDBLocally->setChecked( DOCConduitSettings::keepPDBsLocally() );
00121 fConfigWidget->fConflictResolution->setButton(DOCConduitSettings::conflictResolution() );
00122 fConfigWidget->fConvertBookmarks->setChecked(DOCConduitSettings::convertBookmarks() );
00123 fConfigWidget->fBookmarksBmk->setChecked(DOCConduitSettings::bmkFileBookmarks() );
00124 fConfigWidget->fBookmarksInline->setChecked(DOCConduitSettings::inlineBookmarks() );
00125 fConfigWidget->fBookmarksEndtags->setChecked(DOCConduitSettings::endtagBookmarks() );
00126 fConfigWidget->fCompress->setChecked(DOCConduitSettings::compress() );
00127 fConfigWidget->fSyncDirection->setButton(DOCConduitSettings::syncDirection() );
00128
00129 fConfigWidget->fNoConversionOfBmksOnly->setChecked( DOCConduitSettings::ignoreBmkChanges() );
00130 fConfigWidget->fAlwaysUseResolution->setChecked( DOCConduitSettings::alwaysShowResolutionDialog() );
00131
00132 fConfigWidget->fPCBookmarks->setButton(DOCConduitSettings::bookmarksToPC() );
00133 fConfigWidget->fEncoding->setCurrentText(DOCConduitSettings::encoding() );
00134 unmodified();
00135 }
00136
|