summaryrefslogtreecommitdiffabout
path: root/libkdepim/kcmconfigs
authorulf69 <ulf69>2004-08-06 20:35:30 (UTC)
committer ulf69 <ulf69>2004-08-06 20:35:30 (UTC)
commitda50a4ee7dba00bb6d0d2425298327a41057a02a (patch) (side-by-side diff)
treeb9fb8e4455f71fffb9765b437f546d7e40292753 /libkdepim/kcmconfigs
parentdd23184314a4f181ba00499a89ae04a5092659f4 (diff)
downloadkdepimpi-da50a4ee7dba00bb6d0d2425298327a41057a02a.zip
kdepimpi-da50a4ee7dba00bb6d0d2425298327a41057a02a.tar.gz
kdepimpi-da50a4ee7dba00bb6d0d2425298327a41057a02a.tar.bz2
added new files to support systemwide pim related configuration
Diffstat (limited to 'libkdepim/kcmconfigs') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp77
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.h54
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp273
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h86
4 files changed, 490 insertions, 0 deletions
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
new file mode 100644
index 0000000..77a294a
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -0,0 +1,77 @@
+/*
+ This file is part of KDEPim/Pi.
+ Copyright (c) 2004 Ulf Schenk
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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 <kdebug.h>
+//#include <klocale.h>
+//#include <stdlib.h>
+
+#include "kdepimconfigwidget.h"
+
+#include "kcmkdepimconfig.h"
+#include "kprefs.h"
+#include "kpimprefs.h"
+
+extern "C"
+{
+ KCModule *create_kabconfig( QWidget *parent, const char * ) {
+ return new KCMKdePimConfig( parent, "kcmkdepimconfig" );
+ }
+}
+
+KCMKdePimConfig::KCMKdePimConfig( QWidget *parent, const char *name )
+ : KCModule( parent, name )
+{
+ //abort();
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" );
+ layout->addWidget( mConfigWidget );
+ layout->setSpacing( 0 );
+ layout->setMargin( 0 );
+
+ connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
+}
+
+void KCMKdePimConfig::load(KPrefs* prefs)
+{
+ mConfigWidget->restoreSettings((KPimPrefs*)prefs);
+}
+
+void KCMKdePimConfig::save(KPrefs* prefs)
+{
+ mConfigWidget->saveSettings((KPimPrefs*)prefs);
+}
+
+void KCMKdePimConfig::defaults(KPrefs* prefs)
+{
+ mConfigWidget->defaults((KPimPrefs*)prefs);
+}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h
new file mode 100644
index 0000000..8cb74f4
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h
@@ -0,0 +1,54 @@
+/*
+ This file is part of KdePim/Pi.
+ Copyright (c) 2004 Ulf Schenk
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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$
+*/
+
+#ifndef KCMKDEPIMCONFIG_H
+#define KCMKDEPIMCONFIG_H
+
+#include <kcmodule.h>
+
+class KDEPIMConfigWidget;
+class KPrefs;
+
+class KCMKdePimConfig : public KCModule
+{
+ Q_OBJECT
+
+ public:
+ KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 );
+
+ virtual void load(KPrefs* prefs);
+ virtual void save(KPrefs* prefs);
+ virtual void defaults(KPrefs* prefs);
+
+ private:
+ KDEPIMConfigWidget *mConfigWidget;
+};
+
+#endif
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
new file mode 100644
index 0000000..477267c
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -0,0 +1,273 @@
+/*
+ This file is part of KdePim/Pi.
+ Copyright (c) 2004 Ulf Schenk
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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 <qfile.h>
+
+#include <kdialog.h>
+#include <klocale.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>
+#else // KAB_EMBEDDED
+#include <mergewidget.h>
+#include <distributionlistwidget.h>
+#endif // KAB_EMBEDDED
+
+#include "addresseewidget.h"
+#include "extensionconfigdialog.h"
+#include "extensionwidget.h"
+*/
+
+#include "kpimprefs.h"
+
+#include "kdepimconfigwidget.h"
+
+
+KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
+ KDialog::spacingHint() );
+
+ QTabWidget *tabWidget = new QTabWidget( this );
+ topLayout->addWidget( tabWidget );
+/*US
+ // General page
+ QWidget *generalPage = new QWidget( this );
+ QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
+ KDialog::spacingHintSmall() );
+ //general groupbox
+ QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "General" ), generalPage );
+ QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
+ boxLayout->setAlignment( Qt::AlignTop );
+ boxLayout->setMargin(KDialog::marginHintSmall() );
+ groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
+ groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
+ boxLayout->setSpacing( KDialog::spacingHintSmall() );
+ mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), groupBox, "msingle" );
+ boxLayout->addWidget( mViewsSingleClickBox );
+
+ mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), groupBox, "mparse" );
+ boxLayout->addWidget( mNameParsing );
+
+ layout->addWidget( groupBox );
+
+
+ //extensions groupbox
+
+ QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions" ), generalPage );
+ QVBoxLayout *boxLayout = new QVBoxLayout( groupBox->layout() );
+ boxLayout->setAlignment( Qt::AlignTop );
+ boxLayout->setMargin(KDialog::marginHintSmall());
+ boxLayout->setSpacing(KDialog::spacingHintSmall());
+ groupBox->layout()->setMargin(1) ;
+ groupBox->layout()->setSpacing(0);
+ mExtensionView = new KListView( groupBox );
+ mExtensionView->setAllColumnsShowFocus( true );
+ mExtensionView->addColumn( i18n( "Name" ) );
+ mExtensionView->addColumn( i18n( "Description" ) );
+ mExtensionView->setMaximumHeight(80);
+
+ boxLayout->addWidget( mExtensionView );
+
+ mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
+ mConfigureButton->setEnabled( false );
+ boxLayout->addWidget( mConfigureButton );
+
+ layout->addWidget( groupBox );
+
+ connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
+ connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
+ connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
+ SLOT( selectionChanged( QListViewItem* ) ) );
+ connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
+ SLOT( itemClicked( QListViewItem* ) ) );
+ connect( mConfigureButton, SIGNAL( clicked() ),
+ SLOT( configureExtension() ) );
+
+ tabWidget->addTab( generalPage, i18n( "General" ) );
+
+ // Addressee page
+ mAddresseeWidget = new AddresseeWidget( this );
+ tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
+ connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
+*/
+
+ // mailclient page
+ QWidget *mailclientPage = new QWidget( this );
+ QVBoxLayout* layout = new QVBoxLayout( mailclientPage, KDialog::marginHintSmall(),
+ KDialog::spacingHintSmall() );
+
+ QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), mailclientPage );
+ QVBoxLayout* boxLayout = new QVBoxLayout( groupBox->layout() );
+ boxLayout->setAlignment( Qt::AlignTop );
+// boxLayout->setMargin(KDialog::marginHintSmall() );
+// groupBox->layout()->setMargin(KDialog::marginHintSmall()) ;
+// groupBox->layout()->setSpacing(KDialog::spacingHintSmall());
+// boxLayout->setSpacing( KDialog::spacingHintSmall() );
+
+ mEmailClient = new QComboBox( groupBox );
+ mEmailClient->insertItem( i18n("OM/Pi"), KPimPrefs::OMPI );
+ mEmailClient->insertItem( i18n("Qtopia mail"), KPimPrefs::QTOPIA );
+ mEmailClient->insertItem( i18n("Opie mail"), KPimPrefs::OPIE );
+ mEmailClient->insertItem( i18n("Other"), KPimPrefs::OTHER );
+ boxLayout->addWidget( mEmailClient );
+
+ connect( mEmailClient, SIGNAL( activated( int ) ),
+ this, SLOT (emailclient_changed( int ) ) );
+
+ QLabel* lab = new QLabel( i18n("Channel:"), groupBox);
+ boxLayout->addWidget( lab );
+ mEmailChannel = new QLineEdit(groupBox);
+ mEmailChannel->setReadOnly(true);
+ boxLayout->addWidget( mEmailChannel );
+
+ layout->addWidget( groupBox );
+ tabWidget->addTab( mailclientPage, i18n( "Mail" ) );
+
+
+
+}
+
+
+
+void KDEPIMConfigWidget::emailclient_changed( int newClient )
+{
+ if (newClient == KPimPrefs::OTHER)
+ mEmailChannel->setReadOnly(false);
+ else
+ mEmailChannel->setReadOnly(true);
+
+ QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
+ QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
+
+ if (opiepath.isEmpty())
+ opiepath = qtopiapath;
+
+ QString text = mEmailChannel->text();
+
+ if (newClient == KPimPrefs::OPIE)
+ {
+ if ( QFile::exists( opiepath + "/bin/opiemail" ))
+ text = "QPE/Application/opiemail";
+ else
+ text = "FILENOTFOUND: " + opiepath + "/bin/opiemail";
+ }
+ else if (newClient == KPimPrefs::QTOPIA)
+ {
+ if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
+ text = "QPE/Application/qtmail";
+ else
+ text = "FILENOTFOUND: " + qtopiapath + "/bin/qtmail";
+
+ }
+ else if (newClient == KPimPrefs::OMPI)
+ {
+ if ( QFile::exists( qtopiapath + "/bin/ompi" ))
+ text = "QPE/Application/ompi";
+ else if ( QFile::exists( opiepath + "/bin/ompi" ))
+ text = "QPE/Application/ompi";
+ else
+ text = "FILENOTFOUND: " + qtopiapath + "/bin/ompi";
+
+ }
+ else
+ {
+ //do nothing if we choosed other
+ }
+
+ mEmailChannel->setText( text );
+
+
+}
+
+
+void KDEPIMConfigWidget::restoreSettings(KPimPrefs* prefs)
+{
+ bool blocked = signalsBlocked();
+ blockSignals( true );
+
+ mEmailChannel->setText( prefs->mEmailChannel );
+ mEmailClient->setCurrentItem(prefs->mEmailClient);
+
+ blockSignals( blocked );
+
+ emit changed( false );
+}
+
+void KDEPIMConfigWidget::saveSettings(KPimPrefs* prefs)
+{
+ prefs->mEmailClient = mEmailClient->currentItem();
+ prefs->mEmailChannel = mEmailChannel->text();
+
+ prefs->writeConfig();
+
+ emit changed( false );
+}
+
+void KDEPIMConfigWidget::defaults(KPimPrefs* prefs)
+{
+ mEmailClient->setCurrentItem(KPimPrefs::OMPI);
+ emailclient_changed( KPimPrefs::OMPI );
+
+
+ emit changed( true );
+}
+
+void KDEPIMConfigWidget::modified()
+{
+ emit changed( true );
+}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
new file mode 100644
index 0000000..109a847
--- a/dev/null
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -0,0 +1,86 @@
+/*
+ This file is part of KDEPim/Pi.
+ Copyright (c) 2004 Ulf Schenk
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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$
+*/
+
+#ifndef KDEPIMCONFIGWIDGET_H
+#define KDEPIMCONFIGWIDGET_H
+
+#include <qwidget.h>
+
+/*
+class QCheckBox;
+class QListViewItem;
+class QPushButton;
+class KListView;
+*/
+class QComboBox;
+class QLineEdit;
+class KPimPrefs;
+
+class KDEPIMConfigWidget : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ KDEPIMConfigWidget( QWidget *parent, const char *name = 0 );
+
+ void restoreSettings(KPimPrefs* prefs);
+ void saveSettings(KPimPrefs* prefs);
+ void defaults(KPimPrefs* prefs);
+
+ signals:
+ void changed( bool );
+
+ public slots:
+ void modified();
+
+
+
+ private slots:
+// void configureExtension();
+// void selectionChanged( QListViewItem* );
+// void itemClicked( QListViewItem* );
+ void emailclient_changed( int newClient );
+
+ private:
+// void restoreExtensionSettings();
+// void saveExtensionSettings();
+
+// KListView *mExtensionView;
+
+// QCheckBox *mNameParsing;
+// QCheckBox *mViewsSingleClickBox;
+// QPushButton *mConfigureButton;
+ QComboBox* mEmailClient;
+ QLineEdit* mEmailChannel;
+
+// AddresseeWidget *mAddresseeWidget;
+};
+
+#endif