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

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • conf
dlgwebinterface.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 */
10 
11 #include "dlgwebinterface.h"
12 
13 #include "settings.h"
14 
15 #include <KMessageBox>
16 #include <kwallet.h>
17 
18 DlgWebinterface::DlgWebinterface(KDialog *parent)
19  : QWidget(parent),
20  m_wallet(0)
21 {
22  setupUi(this);
23 
24  readConfig();
25 
26  connect(parent, SIGNAL(accepted()), SLOT(saveSettings()));
27  connect(webinterfacePwd, SIGNAL(textChanged(QString)), SIGNAL(changed()));
28 }
29 
30 DlgWebinterface::~DlgWebinterface()
31 {
32  delete m_wallet;
33 }
34 
35 void DlgWebinterface::readConfig()
36 {
37  if (Settings::webinterfaceEnabled()) {
38  m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(),
39  winId(),
40  KWallet::Wallet::Asynchronous);
41  if (m_wallet) {
42  connect(m_wallet, SIGNAL(walletOpened(bool)), SLOT(walletOpened(bool)));
43  } else {
44  KMessageBox::error(0, i18n("Could not open KWallet"));
45  }
46  }
47 }
48 
49 void DlgWebinterface::walletOpened(bool opened)
50 {
51  if (opened &&
52  (m_wallet->hasFolder("KGet") ||
53  m_wallet->createFolder("KGet")) &&
54  m_wallet->setFolder("KGet")) {
55  QString pwd;
56  m_wallet->readPassword("Webinterface", pwd);
57  webinterfacePwd->setText(pwd);
58  } else {
59  KMessageBox::error(0, i18n("Could not open KWallet"));
60  }
61 }
62 
63 void DlgWebinterface::saveSettings()
64 {
65  if (m_wallet) {
66  m_wallet->writePassword("Webinterface", webinterfacePwd->text());
67  }
68  emit saved();
69 }
70 
71 #include "dlgwebinterface.moc"
dlgwebinterface.h
DlgWebinterface::~DlgWebinterface
~DlgWebinterface()
Definition: dlgwebinterface.cpp:30
QWidget
KDialog
DlgWebinterface::saved
void saved()
DlgWebinterface::changed
void changed()
settings.h
DlgWebinterface::DlgWebinterface
DlgWebinterface(KDialog *parent=0)
Definition: dlgwebinterface.cpp:18
Settings::webinterfaceEnabled
static bool webinterfaceEnabled()
Get WebinterfaceEnabled.
Definition: settings.h:753
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

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

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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