-rw-r--r-- | libkdepim/kprefswidget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libkdepim/kprefswidget.cpp b/libkdepim/kprefswidget.cpp index be9ad30..f6a0b38 100644 --- a/libkdepim/kprefswidget.cpp +++ b/libkdepim/kprefswidget.cpp @@ -163,256 +163,257 @@ QLabel *KPrefsWidFont::preview() return mPreview; } QPushButton *KPrefsWidFont::button() { return mButton; } void KPrefsWidFont::selectFont() { QFont myFont(mPreview->font()); bool ok; myFont = KFontDialog::getFont(myFont, ok); if ( ok ) { mPreview->setFont(myFont); emit modified(); } } KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, QWidget *parent) { mReference = reference; mLabel = new QLabel(text,parent); mSpin = new QSpinBox(0,23,1,parent); mSpin->setSuffix(":00"); connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) ); } void KPrefsWidTime::readConfig() { mSpin->setValue(*mReference); } void KPrefsWidTime::writeConfig() { *mReference = mSpin->value(); } QLabel *KPrefsWidTime::label() { return mLabel; } QSpinBox *KPrefsWidTime::spinBox() { return mSpin; } KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, QWidget *parent) { mReference = reference; mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) ); } KPrefsWidRadios::~KPrefsWidRadios() { } void KPrefsWidRadios::addRadio(const QString &text) { new QRadioButton(text,mBox); } QButtonGroup *KPrefsWidRadios::groupBox() { return mBox; } void KPrefsWidRadios::readConfig() { mBox->setButton(*mReference); } void KPrefsWidRadios::writeConfig() { *mReference = mBox->id(mBox->selected()); } KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, QWidget *parent, QLineEdit::EchoMode echomode) { mReference = reference; mLabel = new QLabel(text,parent); mEdit = new QLineEdit(parent); mEdit->setEchoMode( echomode ); connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) ); } KPrefsWidString::~KPrefsWidString() { } void KPrefsWidString::readConfig() { mEdit->setText(*mReference); } void KPrefsWidString::writeConfig() { *mReference = mEdit->text(); } QLabel *KPrefsWidString::label() { return mLabel; } QLineEdit *KPrefsWidString::lineEdit() { return mEdit; } KPrefsWidget::KPrefsWidget(KPrefs *prefs,QWidget *parent,const char *name) : QWidget(parent, name ) { mPrefs = prefs; + mPrefsWids.setAutoDelete( true ); } KPrefsWidget::~KPrefsWidget() { } void KPrefsWidget::addWid(KPrefsWid *wid) { mPrefsWids.append(wid); connect( wid, SIGNAL( modified() ), this, SLOT( modified() ) ); } KPrefsWidBool *KPrefsWidget::addWidBool(const QString &text,bool *reference,QWidget *parent) { KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent); addWid(w); return w; } KPrefsWidTime *KPrefsWidget::addWidTime(const QString &text,int *reference,QWidget *parent) { KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent); addWid(w); return w; } KPrefsWidColor *KPrefsWidget::addWidColor(const QString &text,QColor *reference,QWidget *parent) { KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent); addWid(w); return w; } KPrefsWidRadios *KPrefsWidget::addWidRadios(const QString &text,int *reference,QWidget *parent) { KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent); addWid(w); return w; } KPrefsWidString *KPrefsWidget::addWidString(const QString &text,QString *reference,QWidget *parent) { KPrefsWidString *w = new KPrefsWidString(text,reference,parent); addWid(w); return w; } KPrefsWidString *KPrefsWidget::addWidPassword(const QString &text,QString *reference,QWidget *parent) { KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password); addWid(w); return w; } KPrefsWidFont *KPrefsWidget::addWidFont(const QString &sampleText,const QString &buttonText, QFont *reference,QWidget *parent) { KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent); addWid(w); return w; } void KPrefsWidget::setDefaults() { mPrefs->setDefaults(); readConfig(); } void KPrefsWidget::readConfig() { // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; KPrefsWid *wid; for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { wid->readConfig(); } usrReadConfig(); emit changed( false ); } void KPrefsWidget::writeConfig() { // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; KPrefsWid *wid; for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { wid->writeConfig(); } usrWriteConfig(); // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; mPrefs->writeConfig(); emit changed( false ); // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; } /*US void KPrefsWidget::slotApply() { writeConfig(); emit configChanged(); } void KPrefsDialog::slotOk() { slotApply(); QDialog::accept(); } void KPrefsDialog::accept() { slotOk(); } void KPrefsDialog::slotDefault() { if (KMessageBox::warningContinueCancel(this, i18n("You are about to set all\npreferences to default values.\nAll " "custom modifications will be lost."),i18n("Setting Default Preferences"), i18n("Continue")) |