summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp41
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h4
-rw-r--r--libkdepim/kpimglobalprefs.cpp7
-rw-r--r--libkdepim/kpimglobalprefs.h6
-rw-r--r--libkdepim/kprefsdialog.cpp2
-rw-r--r--libkdepim/kprefsdialog.h7
6 files changed, 60 insertions, 7 deletions
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 753d90a..fbfbc45 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -14,56 +14,59 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qbuttongroup.h>
+#include <qcheckbox.h>
#include <qfile.h>
#include <qvbox.h>
#include <qdir.h>
#include <qregexp.h>
+#include <qspinbox.h>
#include <kdialog.h>
#include <kprefsdialog.h>
#include <klocale.h>
+#include <kglobalsettings.h>
#include <kdateedit.h>
#include <kglobal.h>
#include <stdlib.h>
/*US
#include <qcheckbox.h>
#include <qframe.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qfile.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#ifndef KAB_EMBEDDED
#include <ktrader.h>
@@ -88,54 +91,90 @@ $Id$
KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
: KPrefsWidget(prefs, parent, name )
{
mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
KDialog::spacingHint() );
tabWidget = new QTabWidget( this );
topLayout->addWidget( tabWidget );
setupLocaleTab();
setupLocaleDateTab();
setupTimeZoneTab();
setupExternalAppTab();
setupStoreTab();
-
+ setupBackupTab();
}
void KDEPIMConfigWidget::showTimeZoneTab()
{
tabWidget->setCurrentPage ( 3 ) ;
}
+void KDEPIMConfigWidget::setupBackupTab()
+{
+ QVBox *colorPage = new QVBox( this );
+ tabWidget->addTab( colorPage, i18n( "Backup" ) );
+ QWidget* topFrame = new QWidget( colorPage );
+ QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
+ KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"),
+ &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame);
+ topLayout->addWidget((QWidget*)sb->checkBox());
+ QWidget* bupFrame = new QWidget( topFrame );
+ topLayout->addWidget((bupFrame));
+ QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
+ QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
+ sb = addWidBool(i18n("Use standard backup dir"),
+ &(KPimGlobalPrefs::instance()->mBackupEnabled),bupFrame);
+ bupLayout->addWidget((QWidget*)sb->checkBox());
+ mBackupUrl = new KURLRequester( bupFrame );
+ mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
+ QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
+ bupLayout->addWidget( mBackupUrl );
+
+
+ QHBox *dummy = new QHBox(bupFrame);
+ new QLabel(i18n("Number of Backups:"),dummy);
+ mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
+ new QLabel(i18n(" "),dummy);
+ bupLayout->addWidget( dummy );
+
+ dummy = new QHBox(bupFrame);
+ new QLabel(i18n("Make backup every "),dummy);
+ mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
+ new QLabel(i18n(" days"),dummy);
+ new QLabel(i18n(" "),dummy);
+ bupLayout->addWidget( dummy );
+
+}
void KDEPIMConfigWidget::setupStoreTab()
{
QVBox *colorPage = new QVBox( this );
tabWidget->addTab( colorPage, i18n( "Colors" ) );
QWidget* cw = new QWidget( colorPage );
KPrefsWidColor *holidayColor =
addWidColor(i18n("Alternating background of list views"),
&(KPimGlobalPrefs::instance()->mAlternateColor),cw);
QHBoxLayout *topLayout = new QHBoxLayout(cw);
topLayout->addWidget(holidayColor->label());
topLayout->addWidget( (QWidget* )holidayColor->button());
QVBox *storePage = new QVBox( this );
new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
mStoreUrl = new KURLRequester( storePage );
mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
#ifdef DESKTOP_VERSION
QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
QFileInfo fi ( confFile );
if ( fi.exists() ) {
KConfig cfg ( confFile );
cfg.setGroup("Global");
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index 984e4e0..c0b92a9 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -58,48 +58,49 @@ class KDEPIMConfigWidget : public KPrefsWidget
protected:
/** Implement this to read custom configuration widgets. */
virtual void usrReadConfig();
/** Implement this to write custom configuration widgets. */
virtual void usrWriteConfig();
private slots:
// void configureExtension();
// void selectionChanged( QListViewItem* );
// void itemClicked( QListViewItem* );
void client_changed( int newClient );
void externalapp_changed( int newApp );
void saveStoreSettings();
void setStandardStore();
void setLocalStore();
private:
void setupExternalAppTab();
void setupLocaleDateTab();
void setupLocaleTab();
void setupTimeZoneTab();
void setupStoreTab();
+ void setupBackupTab();
KURLRequester* mStoreUrl;
void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
void saveEditFieldSettings();
void updateClientWidgets();
QTabWidget *tabWidget;
QLineEdit* mUserDateFormatShort;
QLineEdit* mUserDateFormatLong;
QComboBox* mTimeZoneCombo;
KDateEdit* mStartDateSavingEdit;
KDateEdit* mEndDateSavingEdit;
// void restoreExtensionSettings();
// void saveExtensionSettings();
// KListView *mExtensionView;
// QCheckBox *mNameParsing;
// QCheckBox *mViewsSingleClickBox;
@@ -131,31 +132,32 @@ class KDEPIMConfigWidget : public KPrefsWidget
QString mPhoneOtherMessage;
QString mPhoneOtherMessageParameters;
int mFaxClient;
QString mFaxOtherChannel;
QString mFaxOtherMessage;
QString mFaxOtherMessageParameters;
int mSMSClient;
QString mSMSOtherChannel;
QString mSMSOtherMessage;
QString mSMSOtherMessageParameters;
int mPagerClient;
QString mPagerOtherChannel;
QString mPagerOtherMessage;
QString mPagerOtherMessageParameters;
int mSipClient;
QString mSipOtherChannel;
QString mSipOtherMessage;
QString mSipOtherMessageParameters;
-
+ KURLRequester* mBackupUrl;
+ QSpinBox* mBackupDayCountSpin, *mBackupNumbersSpin ;
QMap<ExternalAppHandler::Types, QString> mExternalAppsMap;
// AddresseeWidget *mAddresseeWidget;
};
#endif
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 873f0eb..90321b2 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -90,48 +90,55 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
addItemString( "FaxChannel", &mFaxOtherChannel, "" );
addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
addItemString( "SMSChannel", &mSMSOtherChannel, "" );
addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
addItemString( "PagerChannel", &mPagerOtherChannel, "" );
addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
addItemString( "SIPChannel", &mSipOtherChannel, "" );
addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
KPrefs::setCurrentGroup( "PhoneAccess" );
addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
+ KPrefs::setCurrentGroup( "BackupSettings" );
+ addItemString("BackupDatadir",&mBackupDatadir,KGlobalSettings::backupDataDir());
+ addItemInt( "BackupNumbers", &mBackupNumbers, 3 );
+ addItemInt( "BackupDayCount", &mBackupDayCount, 2 );
+ addItemBool( "BackupUseDefaultDir",&mBackupUseDefaultDir, true );
+ addItemBool( "BackupEnabled",&mBackupEnabled, false );
+
}
void KPimGlobalPrefs::setGlobalConfig()
{
if ( mLocaleDict == 0 ) {
QString fileName ;
QString name = KGlobal::getAppName() +"/";
#ifndef DESKTOP_VERSION
fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name;
#else
fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
#endif
mLocaleDict = 0;
if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
if ( mPreferredLanguage == 1 )
fileName = fileName+"germantranslation.txt";
else if ( mPreferredLanguage == 4 )
fileName = fileName+"usertranslation.txt";
else if ( mPreferredLanguage == 2 )
fileName = fileName+"frenchtranslation.txt";
else if ( mPreferredLanguage == 3 )
fileName = fileName+"italiantranslation.txt";
QFile file( fileName );
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 36cc25a..94ac8ae 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -119,27 +119,33 @@ class KPimGlobalPrefs : public KPrefs
int mFaxClient;
QString mFaxOtherChannel;
QString mFaxOtherMessage;
QString mFaxOtherMessageParameters;
int mSMSClient;
QString mSMSOtherChannel;
QString mSMSOtherMessage;
QString mSMSOtherMessageParameters;
int mPagerClient;
QString mPagerOtherChannel;
QString mPagerOtherMessage;
QString mPagerOtherMessageParameters;
int mSipClient;
QString mSipOtherChannel;
QString mSipOtherMessage;
QString mSipOtherMessageParameters;
QString mEx2PhoneDevice;
QString mEx2PhoneConnection;
QString mEx2PhoneModel;
+
+ bool mBackupEnabled;
+ QString mBackupDatadir;
+ bool mBackupUseDefaultDir;
+ int mBackupNumbers;
+ int mBackupDayCount;
};
#endif
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp
index dd9a602..b6ae775 100644
--- a/libkdepim/kprefsdialog.cpp
+++ b/libkdepim/kprefsdialog.cpp
@@ -259,49 +259,49 @@ void KPrefsDialogWidString::readConfig()
void KPrefsDialogWidString::writeConfig()
{
*mReference = mEdit->text();
}
QLabel *KPrefsDialogWidString::label()
{
return mLabel;
}
QLineEdit *KPrefsDialogWidString::lineEdit()
{
return mEdit;
}
KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) :
KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent,
name,modal,true)
{
mPrefs = prefs;
// This seems to cause a crash on exit. Investigate later.
-// mPrefsWids.setAutoDelete(true);
+ mPrefsWids.setAutoDelete(true);
connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault()));
//connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault()));
//connect(this,SIGNAL(cancelClicked()),SLOT(reject()));
}
KPrefsDialog::~KPrefsDialog()
{
}
void KPrefsDialog::addWid(KPrefsDialogWid *wid)
{
mPrefsWids.append(wid);
}
KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent)
{
KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent);
addWid(w);
return w;
}
KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent)
{
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h
index ad13b78..efcb86a 100644
--- a/libkdepim/kprefsdialog.h
+++ b/libkdepim/kprefsdialog.h
@@ -25,49 +25,49 @@
// $Id$
#include <qptrlist.h>
#include <qlineedit.h>
#include <kdialogbase.h>
class KPrefs;
class KPrefsDialog;
class KColorButton;
class QCheckBox;
class QLabel;
class QSpinBox;
class QButtonGroup;
/**
@short Base class for widgets used by @ref KPrefsDialog.
@author Cornelius Schumacher
@see KPrefsDialog
This class provides the interface for the preferences widgets used by
KPrefsDialog.
*/
-class KPrefsDialogWid
+class KPrefsDialogWid : public QObject
{
public:
/**
This function is called to read value of the setting from the
stored configuration and display it in the widget.
*/
virtual void readConfig() = 0;
/**
This function is called to write the current setting of the widget to the
stored configuration.
*/
virtual void writeConfig() = 0;
};
/**
@short Widget for bool settings in @ref KPrefsDialog.
This class provides a widget for configuring bool values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
class KPrefsDialogWidBool : public KPrefsDialogWid
{
public:
/**
@@ -115,92 +115,91 @@ class KPrefsDialogWidTime : public KPrefsDialogWid
Return QLabel used by this widget.
*/
QLabel *label();
/**
Return QSpinBox used by this widget.
*/
QSpinBox *spinBox();
void readConfig();
void writeConfig();
private:
int *mReference;
QLabel *mLabel;
QSpinBox *mSpin;
};
/**
@short Widget for color settings in @ref KPrefsDialog.
This class provides a widget for configuring color values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
-class KPrefsDialogWidColor : public QObject, public KPrefsDialogWid
+class KPrefsDialogWidColor : public KPrefsDialogWid
{
- Q_OBJECT
public:
/**
Create a color widget consisting of a test field and a button for opening
a color dialog.
@param text Text of button.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
KPrefsDialogWidColor(const QString &text,QColor *reference,QWidget *parent);
/**
Destruct color setting widget.
*/
~KPrefsDialogWidColor();
/**
Return QLabel for the button
*/
QLabel *label();
/**
Return button opening the color dialog.
*/
KColorButton *button();
void readConfig();
void writeConfig();
private:
QColor *mReference;
QLabel *mLabel;
KColorButton *mButton;
};
/**
@short Widget for font settings in @ref KPrefsDialog.
This class provides a widget for configuring font values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
-class KPrefsDialogWidFont : public QObject, public KPrefsDialogWid
+class KPrefsDialogWidFont : public KPrefsDialogWid
{
Q_OBJECT
public:
/**
Create a font widget consisting of a test field and a button for opening
a font dialog.
@param label Text of label.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
KPrefsDialogWidFont(const QString &sampleText,const QString &labelText,
QFont *reference,QWidget *parent);
/**
Destruct font setting widget.
*/
~KPrefsDialogWidFont();
/**
Return label.
*/
QLabel *label();
/**
Return QFrame used as preview field.