summaryrefslogtreecommitdiffabout
path: root/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
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/kdepimconfigwidget.cpp
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/kdepimconfigwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp273
1 files changed, 273 insertions, 0 deletions
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 );
+}