[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/mailody
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2008-02-12 23:04:02
Message-ID: 1202857442.225854.24682.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 774296 by toma:

Add a kcm for the configuration of the imaplib resources. Adjust Mailody to use this \
kcm in the settings.  The kcm is not yet finished. just a start.


 M  +13 -0     akonadi_resource/CMakeLists.txt  
 A             akonadi_resource/configmodule.cpp   \
trunk/KDE/kdepimlibs/mailtransport/configmodule.cpp#751355 [License: LGPL (v2+)]  A   \
akonadi_resource/configmodule.h   \
trunk/KDE/kdepimlibs/mailtransport/configmodule.h#751355 [License: LGPL (v2+)]  A     \
akonadi_resource/imaplib_export.h   \
trunk/KDE/kdepimlibs/mailtransport/mailtransport_export.h#751355 [License: LGPL \
(v2+)]  A             akonadi_resource/imaplibmanagementwidget.cpp   \
trunk/KDE/kdepimlibs/mailtransport/transportmanagementwidget.cpp#751355 [License: \
LGPL (v2+)]  A             akonadi_resource/imaplibmanagementwidget.h   \
trunk/KDE/kdepimlibs/mailtransport/transportmanagementwidget.h#751355 [License: LGPL \
(v2+)]  A             akonadi_resource/imaplibmanagementwidget.ui   \
trunk/KDE/kdepimlibs/mailtransport/transportmanagementwidget.ui#751355  A             \
akonadi_resource/kcm_imaplib.desktop   \
trunk/KDE/kdepimlibs/mailtransport/kcm_mailtransport.desktop#751355  M  +0 -1      \
src/setup.cpp    M  +7 -234    src/setupservers.cpp  
 M  +2 -42     src/setupservers.h  


--- trunk/playground/pim/mailody/akonadi_resource/CMakeLists.txt #774295:774296
@@ -53,3 +53,16 @@
 
 install(TARGETS akonadi_imaplib_resource DESTINATION ${BIN_INSTALL_DIR})
 
+
+################# Next target
+
+set(imaplib_kcm_srcs configmodule.cpp imaplibmanagementwidget.cpp)
+kde4_add_ui_files(imaplib_kcm_srcs imaplibmanagementwidget.ui )
+kde4_add_plugin(kcm_imaplib ${imaplib_kcm_srcs})
+target_link_libraries(kcm_imaplib  ${KDE4_KDEUI_LIBS})
+
+install(TARGETS kcm_imaplib  DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES kcm_imaplib.desktop  DESTINATION ${SERVICES_INSTALL_DIR})
+
+install(FILES imaplib_export.h imaplibmanagementwidget.h
+         DESTINATION ${INCLUDE_INSTALL_DIR} )
--- trunk/playground/pim/mailody/src/setup.cpp #774295:774296
@@ -81,7 +81,6 @@
 
 void Setup::slotOkClicked()
 {
-    m_serversPage->applySettings();
     m_identitiesPage->applySettings();
     m_miscPage->applySettings();
     close();
--- trunk/playground/pim/mailody/src/setupservers.cpp #774295:774296
@@ -1,5 +1,5 @@
 /* This file is part of the KDE project
-   Copyright (C) 2006-2007 Omat Holding B.V. <info@omat.nl>
+   Copyright (C) 2006-2008 Omat Holding B.V. <info@omat.nl>
    Copyright (C) 2006 Frode M. Døving <frode@lnix.net>
 
    Original copied from showfoto:
@@ -22,15 +22,8 @@
 
 // Own
 #include "setupservers.h"
-#include "global.h"
 
 // Qt
-#include <QLabel>
-#include <QProgressBar>
-#include <QPushButton>
-#include <QButtonGroup>
-#include <QGroupBox>
-#include <QRadioButton>
 #include <QGridLayout>
 
 // KDEPIMLIBS
@@ -38,23 +31,10 @@
 #include <mailtransport/transport.h>
 
 // KDE
-#include <kconfig.h>
 #include <KCModuleLoader>
-#include <kdebug.h>
-#include <kdialog.h>
-#include <kuser.h>
-#include <kapplication.h>
-#include <klocale.h>
-#include <klineedit.h>
-#include <kmessagebox.h>
-#include <ktabwidget.h>
-#include <kemailsettings.h>
-#include <kwallet.h>
-#include <knuminput.h>
-#include <solid/networking.h>
+#include <KTabWidget>
+#include <KDebug>
 
-using KWallet::Wallet;
-
 using namespace Mailody;
 
 SetupServers::SetupServers( QWidget* parent )
@@ -67,224 +47,17 @@
     mainGrid->addWidget( tabWidget, 0, 0 );
     mainGrid->setRowStretch( 0, 0 );
 
-    // ------------- page 1 -------------------------- //
+    tabWidget->addTab( KCModuleLoader::loadModule( "kcm_imaplib",
+                       KCModuleLoader::Inline, this ),
+                       i18n( "Imap Servers" ) );
 
-    QWidget* page1 = new QWidget( this );
-    QGridLayout* m2 = new QGridLayout( page1 );
-
-    QLabel *l4 = new QLabel( i18n( "IMAP server:" ) + ' ', page1 );
-    m2->addWidget( l4, 0, 0 );
-    l4->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
-    l4->setWhatsThis( i18n( "Indicate the IMAP server. If you want to "
-                            "connect to a non-standard port for a chosen safety, you \
                can add "
-                            "\":port\" to indicate that. For example: \
                \"imap.bla.nl:144\"" ) );
-    m_imapServer = new KLineEdit( page1 );
-    m2->addWidget( m_imapServer, 0, 1 );
-    l4->setBuddy( m_imapServer );
-    connect( m_imapServer, SIGNAL( textChanged( const QString & ) ),
-             SLOT( slotTestChanged() ) );
-
-    QLabel *l5 = new QLabel( i18n( "Safety:" ) + ' ', page1 );
-    m2->addWidget( l5, 2, 0 );
-    l5->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
-    l5->setWhatsThis( i18n( "<b>SSL</b> is safe IMAP over port 993, <b>TLS</b> "
-                            "will operate on port 143 and switch to a secure \
                connection "
-                            "directly after connecting and <b>None</b> will connect \
                to port "
-                            "143 but not switch to a secure connection. This setting \
                is not "
-                            "recommended." ) );
-    m_safeImap = new QGroupBox( page1 );
-    QHBoxLayout* safePartLay = new QHBoxLayout( m_safeImap );
-    safePartLay->setMargin( 0 );
-    safePartLay->setSpacing( KDialog::spacingHint() );
-    m_testButton = new QPushButton( i18n( "Auto detect" ), m_safeImap );
-    safePartLay->addWidget( m_testButton );
-    m_noRadio = new QRadioButton( i18n( "None" ), m_safeImap );
-    safePartLay->addWidget( m_noRadio );
-    m_sslRadio = new QRadioButton( i18n( "SSL" ), m_safeImap );
-    safePartLay->addWidget( m_sslRadio );
-    m_tlsRadio = new QRadioButton( i18n( "TLS" ), m_safeImap );
-    safePartLay->addWidget( m_tlsRadio );
-    m2->addWidget( m_safeImap,2,1 );
-    l5->setBuddy( m_safeImap );
-
-    connect( m_testButton, SIGNAL( pressed() ), SLOT( slotTest() ) );
-
-    m_safeImap_group = new QButtonGroup( page1 );
-    m_safeImap_group->addButton( m_noRadio,1 );
-    m_safeImap_group->addButton( m_sslRadio,2 );
-    m_safeImap_group->addButton( m_tlsRadio,3 );
-
-    QLabel *l6 = new QLabel( i18n( "Username:" ) + ' ', page1 );
-    m2->addWidget( l6,3,0 );
-    l6->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
-    l6->setWhatsThis( i18n( "The username" ) );
-    m_userName = new KLineEdit( page1 );
-    m2->addWidget( m_userName,3,1 );
-    l6->setBuddy( m_userName );
-
-    QLabel *l7 = new QLabel( i18n( "Password:" ) + ' ', page1 );
-    m2->addWidget( l7,4,0 );
-    l7->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
-    l7->setWhatsThis( i18n( "The password" ) );
-    m_password = new KLineEdit( page1 );
-    m_password->setPasswordMode( true );
-    m2->addWidget( m_password,4, 1 );
-    l7->setBuddy( m_password );
-
-    QSpacerItem* spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum,
-                                            QSizePolicy::Expanding );
-    m2->addItem( spacer2, 5, 1 );
-
-    m_testInfo = new QLabel( page1 );
-    m_testInfo->setAlignment( Qt::AlignHCenter );
-    m_testInfo->hide();
-    m2->addWidget( m_testInfo, 6, 1 );
-
-    m_testProgress = new QProgressBar( page1 );
-    m2->addWidget( m_testProgress, 7, 1 );
-    m_testProgress->hide();
-
-    QSpacerItem* spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum,
-                                            QSizePolicy::Expanding );
-    m2->addItem( spacer3, 8, 1 );
-
-    tabWidget->addTab( page1,i18n( "IMAP server" ) );
-
-    // -------------- page 2 ---------------------- //
-
     tabWidget->addTab( KCModuleLoader::loadModule( "kcm_mailtransport",
                        KCModuleLoader::Inline, this ),
-                       i18n( "SMTP Server" ) );
+                       i18n( "SMTP Servers" ) );
 
     mainLayout->addWidget( this );
-
-    readSettings();
-
-    if ( !Global::cryptoConnectionSupported() ) {
-        m_tlsRadio->setEnabled( false );
-        m_sslRadio->setEnabled( false );
-        m_safeImap_group->button( 1 )->setChecked( true );
-    }
-
-    slotTestChanged();
-    connect( Solid::Networking::notifier(),
-             SIGNAL( statusChanged( Solid::Networking::Status ) ),
-             SLOT( slotTestChanged() ) );
 }
 
 SetupServers::~SetupServers()
 {
 }
-
-void SetupServers::applySettings()
-{
-    KConfigGroup config = KGlobal::config()->group( "General" );
-    config.writeEntry( "imapServer", m_imapServer->text() );
-    config.writeEntry( "userName", m_userName->text() );
-    config.writeEntry( "safeImap", m_safeImap_group->checkedId() );
-    config.sync();
-
-    Wallet* wallet = Wallet::openWallet( Wallet::NetworkWallet(), this->winId() );
-    if ( wallet && wallet->isOpen() ) {
-        if ( !wallet->hasFolder( "mailody" ) )
-            wallet->createFolder( "mailody" );
-
-        wallet->setFolder( "mailody" );
-        wallet->writePassword( "account1", m_password->text() );
-    }
-    kDebug() << "Wallet save: " << wallet->sync() << endl;
-    delete wallet;
-}
-
-void SetupServers::readSettings()
-{
-    KConfigGroup config = KGlobal::config()->group( "General" );
-    KUser* currentUser = new KUser();
-    KEMailSettings esetting;
-
-    m_imapServer->setText( config.readEntry( "imapServer",
-                           esetting.getSetting( KEMailSettings::InServer ) ) );
-    m_userName->setText( config.readEntry( "userName",
-                                           currentUser->loginName() ) );
-    int i = config.readEntry( "safeImap", 2 );
-    if ( i == 0 )
-        i = 1;
-    m_safeImap_group->button( i )->setChecked( true );
-
-    QString pass;
-    Wallet* wallet = Wallet::openWallet( Wallet::NetworkWallet(), this->winId() );
-    if ( !wallet ) {
-        m_password->setEnabled( false );
-        KMessageBox::information( 0,i18n( "Mailody could not access KWallet, "
-                                          "if you want to store the password \
                permanently then you have to "
-                                          "activate it. If you do not "
-                                          "want to use KWallet, check the box below \
                and enjoy the dialogs." ),
-                                  i18n( "Do not use KWallet" ), \
                "warning_kwallet_disabled" );
-    } else if ( wallet->isOpen() && wallet->hasFolder( "mailody" ) ) {
-        wallet->setFolder( "mailody" );
-        wallet->readPassword( "account1", pass );
-    }
-    m_password->insert( pass );
-}
-
-void SetupServers::slotTest()
-{
-    kDebug() << m_imapServer->text() << endl;
-
-    m_testInfo->clear();
-    m_sslRadio->setEnabled( false );
-    m_tlsRadio->setEnabled( false );
-    m_noRadio->setEnabled( false );
-
-
-    MailTransport::ServerTest* test = new MailTransport::ServerTest( this );
-    test->setServer( m_imapServer->text() );
-    test->setProtocol( "imap" );
-    test->setProgressBar( m_testProgress );
-    connect( test, SIGNAL( finished( QList<int> ) ),
-             SLOT( slotFinished( QList<int> ) ) );
-    test->start();
-}
-
-void SetupServers::slotFinished( QList<int> testResult )
-{
-    kDebug() << testResult << endl;
-
-    using namespace MailTransport;
-
-    m_testInfo->show();
-
-    if ( testResult.contains( Transport::EnumEncryption::SSL ) )
-        m_sslRadio->setEnabled( true );
-
-    if ( testResult.contains( Transport::EnumEncryption::TLS ) )
-        m_tlsRadio->setEnabled( true );
-
-    if ( testResult.contains( Transport::EnumEncryption::None ) )
-        m_noRadio->setEnabled( true );
-
-    QString text;
-    if ( testResult.contains( Transport::EnumEncryption::SSL ) ) {
-        m_safeImap_group->button( 2 )->setChecked( true );
-        text = i18n( "<qt><b>SSL is supported and recommended</b></qt>" );
-    } else if ( testResult.contains( Transport::EnumEncryption::TLS ) ) {
-        m_safeImap_group->button( 3 )->setChecked( true );
-        text = i18n( "<qt><b>TLS is supported and recommended</b></qt>" );
-    } else if ( testResult.contains( Transport::EnumEncryption::None ) ) {
-        m_safeImap_group->button( 1 )->setChecked( true );
-        text = i18n( "<qt><b>No security is supported. It is not "
-                     "recommended to connect to this server.</b></qt>" );
-    } else {
-        text = i18n( "<qt><b>It is not possible to use this server.</b></qt>" );
-    }
-    m_testInfo->setText( text );
-}
-
-void SetupServers::slotTestChanged()
-{
-    // dont use imapConnectionPossible, as the data is not yet saved.
-    m_testButton->setEnabled( Global::connectionPossible() ||
-                              m_imapServer->text() == "localhost" );
-}
-
-#include "setupservers.moc"
--- trunk/playground/pim/mailody/src/setupservers.h #774295:774296
@@ -1,9 +1,6 @@
 /* This file is part of the KDE project
-   Copyright (C) 2006-2007 Omat Holding B.V. <info@omat.nl>
+   Copyright (C) 2006-2008 Omat Holding B.V. <info@omat.nl>
 
-   Original copied from showfoto:
-    Copyright 2005 by Gilles Caulier <caulier.gilles@free.fr>
-
    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
@@ -22,15 +19,8 @@
 #ifndef SETUPSERVERS_H
 #define SETUPSERVERS_H
 
-#include <klineedit.h>
+#include <QWidget>
 
-class QProgressBar;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QRadioButton;
-class QPushButton;
-
 namespace Mailody
 {
 
@@ -38,14 +28,10 @@
 /**
  * @class SetupServers
  * These contain the account settings
- * This file is originally copied from showfoto
- * @author Gilles Caulier <caulier.gilles@free.fr>
  * @author Tom Albers <tomalbers@kde.nl>
  */
 class SetupServers : public QWidget
 {
-    Q_OBJECT
-
 public:
     /**
      * Constructor
@@ -57,32 +43,6 @@
      * Destructor
      */
     ~SetupServers();
-
-    /**
-     * Call this if you want the settings saved from this page.
-     */
-    void applySettings();
-
-private:
-    void readSettings();
-
-    QGroupBox*          m_safeImap;
-    QButtonGroup*       m_safeImap_group;
-    KLineEdit*          m_imapServer;
-    KLineEdit*          m_userName;
-    KLineEdit*          m_password;
-    QLabel*             m_testInfo;
-    QProgressBar*       m_testProgress;
-
-    QPushButton*        m_testButton;
-    QRadioButton*       m_noRadio;
-    QRadioButton*       m_sslRadio;
-    QRadioButton*       m_tlsRadio;
-
-private slots:
-    void slotTest();
-    void slotFinished( QList<int> testResult );
-    void slotTestChanged();
 };
 
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic