• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

blogilo

  • sources
  • kde-4.14
  • kdepim
  • blogilo
  • src
configurestorageservicewidget.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "configurestorageservicewidget.h"
19 #include "settings.h"
20 #include "pimcommon/storageservice/widgets/storageserviceconfigurewidget.h"
21 #include "pimcommon/storageservice/settings/storageservicesettingswidget.h"
22 #include "pimcommon/storageservice/storageservicemanager.h"
23 
24 #include <KLocalizedString>
25 #include <KStandardDirs>
26 #include <KMessageBox>
27 #include <KUrlRequester>
28 
29 #include <QVBoxLayout>
30 #include <QProcess>
31 #include <QPushButton>
32 
33 StorageServiceConfigureWidget::StorageServiceConfigureWidget(QWidget *parent)
34  : PimCommon::StorageServiceConfigureWidget(parent)
35 {
36 
37 }
38 
39 StorageServiceConfigureWidget::~StorageServiceConfigureWidget()
40 {
41 
42 }
43 
44 void StorageServiceConfigureWidget::loadSettings()
45 {
46  downloadFolder()->setUrl(KUrl(Settings::self()->downloadDirectory()));
47 }
48 
49 void StorageServiceConfigureWidget::writeSettings()
50 {
51  Settings::self()->setDownloadDirectory(downloadFolder()->url().path());
52  Settings::self()->writeConfig();
53 }
54 
55 ConfigureStorageServiceWidget::ConfigureStorageServiceWidget(PimCommon::StorageServiceManager *storageManager, QWidget *parent)
56  : QWidget(parent),
57  mStorageManager(storageManager)
58 {
59  QVBoxLayout *lay = new QVBoxLayout;
60  mStorageServiceConfigureWidget = new StorageServiceConfigureWidget;
61  connect(mStorageServiceConfigureWidget, SIGNAL(changed()), this, SIGNAL(changed()));
62  lay->addWidget(mStorageServiceConfigureWidget);
63 
64  QHBoxLayout *hbox = new QHBoxLayout;
65  mManageStorageService = new QPushButton(i18n("Manage Storage Service"));
66  hbox->addWidget(mManageStorageService);
67  hbox->addStretch();
68  lay->addLayout(hbox);
69  if (KStandardDirs::findExe(QLatin1String("storageservicemanager")).isEmpty()) {
70  mManageStorageService->setEnabled(false);
71  } else {
72  connect(mManageStorageService, SIGNAL(clicked(bool)), this, SLOT(slotManageStorageService()));
73  }
74  setLayout(lay);
75  //TODO need to implement save/load from KDialogConfig
76 
77  QList<PimCommon::StorageServiceAbstract::Capability> lst;
78  lst.append(PimCommon::StorageServiceAbstract::UploadFileCapability);
79  lst.append(PimCommon::StorageServiceAbstract::DownloadFileCapability);
80 
81  mStorageServiceConfigureWidget->storageServiceSettingsWidget()->setListService(mStorageManager->listService(), lst);
82 
83  doLoadFromGlobalSettings();
84 }
85 
86 ConfigureStorageServiceWidget::~ConfigureStorageServiceWidget()
87 {
88 }
89 
90 void ConfigureStorageServiceWidget::slotManageStorageService()
91 {
92  if ( !QProcess::startDetached(QLatin1String("storageservicemanager") ) )
93  KMessageBox::error( this, i18n( "Could not start storage service manager; "
94  "please check your installation." ),
95  i18n( "KMail Error" ) );
96 }
97 
98 void ConfigureStorageServiceWidget::save()
99 {
100  mStorageManager->setListService(mStorageServiceConfigureWidget->storageServiceSettingsWidget()->listService());
101  mStorageServiceConfigureWidget->writeSettings();
102 }
103 
104 void ConfigureStorageServiceWidget::doLoadFromGlobalSettings()
105 {
106  mStorageServiceConfigureWidget->loadSettings();
107 }
108 
109 #include "moc_configurestorageservicewidget.cpp"
QWidget
StorageServiceConfigureWidget::loadSettings
virtual void loadSettings()
Definition: configurestorageservicewidget.cpp:44
QProcess::startDetached
bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory, qint64 *pid)
QHBoxLayout
QWidget::setEnabled
void setEnabled(bool)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QList::append
void append(const T &value)
QWidget::setLayout
void setLayout(QLayout *layout)
QVBoxLayout
StorageServiceConfigureWidget
Definition: configurestorageservicewidget.h:25
QList
ConfigureStorageServiceWidget::~ConfigureStorageServiceWidget
~ConfigureStorageServiceWidget()
Definition: configurestorageservicewidget.cpp:86
StorageServiceConfigureWidget::writeSettings
virtual void writeSettings()
Definition: configurestorageservicewidget.cpp:49
ConfigureStorageServiceWidget::doLoadFromGlobalSettings
void doLoadFromGlobalSettings()
Definition: configurestorageservicewidget.cpp:104
ConfigureStorageServiceWidget::changed
void changed()
StorageServiceConfigureWidget::StorageServiceConfigureWidget
StorageServiceConfigureWidget(QWidget *parent=0)
Definition: configurestorageservicewidget.cpp:33
ConfigureStorageServiceWidget::save
void save()
Definition: configurestorageservicewidget.cpp:98
QLatin1String
QBoxLayout::addStretch
void addStretch(int stretch)
StorageServiceConfigureWidget::~StorageServiceConfigureWidget
~StorageServiceConfigureWidget()
Definition: configurestorageservicewidget.cpp:39
configurestorageservicewidget.h
QPushButton
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
ConfigureStorageServiceWidget::ConfigureStorageServiceWidget
ConfigureStorageServiceWidget(PimCommon::StorageServiceManager *storageManager, QWidget *parent=0)
Definition: configurestorageservicewidget.cpp:55
QBoxLayout::addLayout
void addLayout(QLayout *layout, int stretch)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:16 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

blogilo

Skip menu "blogilo"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal