mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
generic: drop kwallet and kpasswdserver
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
3395ea5c29
commit
a88e93c48e
142 changed files with 0 additions and 17623 deletions
|
@ -340,8 +340,6 @@ add_subdirectory(kstyles)
|
|||
|
||||
# imported from kde-runtime and other sub-projects
|
||||
add_subdirectory(menu)
|
||||
add_subdirectory(kwalletd)
|
||||
add_subdirectory(kwalletmanager)
|
||||
add_subdirectory(knotify)
|
||||
add_subdirectory(kuiserver)
|
||||
add_subdirectory(soliduiserver)
|
||||
|
@ -358,7 +356,6 @@ if (Q_WS_X11)
|
|||
add_subdirectory(kstart)
|
||||
endif (Q_WS_X11)
|
||||
# Background processes
|
||||
add_subdirectory(kpasswdserver)
|
||||
add_subdirectory(kdontchangethehostname)
|
||||
add_subdirectory(kglobalaccel)
|
||||
add_subdirectory(ktimezoned)
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
if(ENABLE_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
set(kded_kpasswdserver_SRCS kpasswdserver.cpp )
|
||||
|
||||
qt4_add_dbus_adaptor(kded_kpasswdserver_SRCS org.kde.KPasswdServer.xml kpasswdserver.h KPasswdServer)
|
||||
|
||||
kde4_add_plugin(kded_kpasswdserver ${kded_kpasswdserver_SRCS})
|
||||
|
||||
target_link_libraries(kded_kpasswdserver ${KDE4_KIO_LIBS})
|
||||
|
||||
install(TARGETS kded_kpasswdserver DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} )
|
||||
|
||||
install( FILES kpasswdserver.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kded )
|
|
@ -1,74 +0,0 @@
|
|||
Credentials storage duration
|
||||
============================
|
||||
How long credentials are stored depends on a couple of factors. The first is
|
||||
whether a window-id (see QWidget::WId) was provided when the password request
|
||||
was made. The other is the state of KIO::AuthInfo's keepPassword flag.
|
||||
|
||||
If the window-id parameter is missing, the credentials are stored for the
|
||||
entire duration of the current KDE session. Otherwise, they are only kept
|
||||
until the application(s) associated with the window-id exit.
|
||||
|
||||
The "keepPassword" flag on the other hand only matters for caching credetials
|
||||
in a persistent storage such as KWallet. If this flag is set to false, then
|
||||
credentials are only kept in memory based on the value of window-id as discussed
|
||||
above. See the documentation for the "keepPassword" property in KIO::AuthInfo
|
||||
for more details.
|
||||
|
||||
Dawit A. <adawit@kde.org>
|
||||
|
||||
Sequence numbers
|
||||
================
|
||||
The idea is that whenever the user is queried for a password this
|
||||
login/pw combination gets a seq-nr. When a slave needs a login/pw
|
||||
it asks kpasswdserver and sends along the last seqnr it received. If
|
||||
this seqnr is older (lower) than the seq nr of the login/pw
|
||||
combination stored in kpasswdserver then appearantly the user has
|
||||
already been prompted for a new login/pw combination since the last
|
||||
time this slave asked for a login/pw and therefor it is not necessary
|
||||
to prompt the user again but kpassword will send the io-slave this
|
||||
new login/pw combination. If this new combination fails as well the
|
||||
user is being prompted for a new login/pw combo since the one stored
|
||||
in kpasswdserver doesn't work.
|
||||
|
||||
Let me try to draw the situation I had in mind when writing this:
|
||||
|
||||
Slave1 Slave2 kpasswdserver
|
||||
Asks for auth
|
||||
asks user for login/pw (1)
|
||||
sends login/pw (1) to ftp site
|
||||
Asks for auth
|
||||
sends back login/pw (1)
|
||||
sends login/pw (1) to ftp site
|
||||
gets login error,
|
||||
asks for new auth
|
||||
sends along seq.nr 1
|
||||
seq.nr 1 == (1) -->
|
||||
asks user for new login/pw (2)
|
||||
sends login/pw (2) to ftp site
|
||||
gets login error,
|
||||
asks for new auth
|
||||
sends along seq.nr 1
|
||||
seq.nr 1 < (2) -->
|
||||
don't ask user for new login/pw
|
||||
but send back login/pw (2) without asking
|
||||
sends login/pw (2) to ftp site
|
||||
|
||||
|
||||
Actually, I had mostly http in mind, and not so much ftp. In http you
|
||||
typically try without password first, and only when you get an
|
||||
authentication error you ask for a password. The above scenario is
|
||||
then suddenly a lot more common than with ftp because it can happen
|
||||
that you have 4 requests /io-slaves who alll discover at about the
|
||||
same time that they need to have authentication credentials. The
|
||||
above scenario (and the seq. nrs) is to prevent that you get 4 login
|
||||
dialogs in such case.
|
||||
|
||||
Now the assumption in this all, looking back on it, seems to be that
|
||||
when you ask for the same auth credentials twice in a row, it must be
|
||||
that the credentials issued the first time where wrong, and you will
|
||||
be prompted again. But if the user goes to ftp-site1, then
|
||||
ftp-site2 and then back to ftp-site1 again, the credentials for ftp-site1
|
||||
are still valid. This is why we reset the seq.nr stored in the io-slave
|
||||
to 0 whenever the io-slave switches hosts (or logins).
|
||||
|
||||
Waldo Bastian <bastian@kde.org>
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
$XGETTEXT *.cpp -o $podir/kpasswdserver.pot
|
File diff suppressed because it is too large
Load diff
|
@ -1,145 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
Name=Password Caching
|
||||
Name[ar]=تخزين مؤقت لكلمة السر
|
||||
Name[ast]=Caché de contraseñes
|
||||
Name[bg]=Запомняне на пароли
|
||||
Name[bn]=পাসওয়ার্ড ক্যাশিং
|
||||
Name[bs]=Keširanje lozinke
|
||||
Name[ca]=Cau de les contrasenyes
|
||||
Name[ca@valencia]=Ús de memòria cau de contrasenyes
|
||||
Name[cs]=Dočasné ukládání hesel do mezipaměti
|
||||
Name[da]=Caching af adgangskoder
|
||||
Name[de]=Passwort-Zwischenspeicherung
|
||||
Name[el]=Λανθάνουσας μνήμη κωδικού πρόσβασης
|
||||
Name[en_GB]=Password Caching
|
||||
Name[eo]=Kaŝmemorado por pasvorto
|
||||
Name[es]=Caché de contraseñas
|
||||
Name[et]=Parooli puhverdamine
|
||||
Name[eu]=Pasahitza cachean gordetzea
|
||||
Name[fa]=نهانسازی رمزعبور
|
||||
Name[fi]=Salasanavälimuisti
|
||||
Name[fr]=Masquage du mot de passe
|
||||
Name[ga]=Taisce Focal Faire
|
||||
Name[gl]=Caché de contrasinais
|
||||
Name[gu]=પાસવર્ડ કેશિંગ
|
||||
Name[he]=שמירת סיסמאות במטמון
|
||||
Name[hi]=पासवर्ड कैशिंग
|
||||
Name[hr]=Spremanje zaporke u privremenu memoriju
|
||||
Name[hu]=Jelszavak gyorsítótárazása
|
||||
Name[ia]=Ponente in cache le contrasigno
|
||||
Name[id]=Penyimpanan sandi
|
||||
Name[is]=Skyndiminni fyrir lykilorð
|
||||
Name[it]=Memorizzazione delle password
|
||||
Name[ja]=パスワードキャッシング
|
||||
Name[kk]=Паролін кэштеу
|
||||
Name[km]=ឃ្លាំងសម្ងាត់ពាក្យសម្ងាត់
|
||||
Name[kn]=ಗುಪ್ತಪದ (ಪಾಸ್ ವರ್ಡ್) ಸಂಗ್ರಹಣೆ (ಕ್ಯಾಶಿಂಗ್)
|
||||
Name[ko]=암호 캐싱
|
||||
Name[lt]=Slaptažodžio prisiminimas
|
||||
Name[lv]=Paroļu saglabāšana
|
||||
Name[mai]=गूढ़किल्ली कैशिंग
|
||||
Name[ml]=അടയാളവാക്കു് ഓര്ത്തുവയ്ക്കുക
|
||||
Name[mr]=गुप्तशब्द आठवणीत ठेवत आहे
|
||||
Name[nb]=Passordlagring
|
||||
Name[nds]=Twischenspiekern vun Passwöör
|
||||
Name[nl]=Caching van wachtwoorden
|
||||
Name[nn]=Mellomlager for passord
|
||||
Name[pa]=ਪਾਸਵਰਡ ਕੈਸ਼ਿੰਗ
|
||||
Name[pl]=Zapamiętywanie haseł
|
||||
Name[pt]='Cache' de Senhas
|
||||
Name[pt_BR]=Cache de senhas
|
||||
Name[ro]=Stocare parole
|
||||
Name[ru]=Кэширование паролей
|
||||
Name[si]=මුරපද කැචේ කිරීම
|
||||
Name[sk]=Ukladanie hesiel do vyrovnávacej pamäte
|
||||
Name[sl]=Predpomnjenje gesel
|
||||
Name[sr]=Кеширање лозинке
|
||||
Name[sr@ijekavian]=Кеширање лозинке
|
||||
Name[sr@ijekavianlatin]=Keširanje lozinke
|
||||
Name[sr@latin]=Keširanje lozinke
|
||||
Name[sv]=Lösenordslagring
|
||||
Name[tg]=Захираи парол
|
||||
Name[th]=การจัดเก็บรหัสผ่าน
|
||||
Name[tr]=Parola Önbellekleme
|
||||
Name[ug]=ئىم غەملەك
|
||||
Name[uk]=Кешування паролів
|
||||
Name[vi]=Lưu đệm mật khẩu
|
||||
Name[wa]=Muchete do scret
|
||||
Name[x-test]=xxPassword Cachingxx
|
||||
Name[zh_CN]=密码缓存
|
||||
Name[zh_TW]=密碼快取
|
||||
Comment=Temporary password caching
|
||||
Comment[ar]=تخبئة (تخزين مؤقت) لكلمات السر
|
||||
Comment[ast]=Cachéu temporal de contraseñes
|
||||
Comment[bg]=Временно запомняне на пароли
|
||||
Comment[bn]=সাময়িক পাসওয়ার্ড ক্যাশিং
|
||||
Comment[bs]=Privremeno keširanje lozinke
|
||||
Comment[ca]=Cau temporal de les contrasenyes
|
||||
Comment[ca@valencia]=Ús temporal de memòria cau de contrasenyes
|
||||
Comment[cs]=Dočasné ukládání hesel do mezipaměti
|
||||
Comment[da]=Midlertidig caching af adgangskoder
|
||||
Comment[de]=Temporäre Passwort-Zwischenspeicherung
|
||||
Comment[el]=Προσωρινή λανθάνουσα μνήμη κωδικού πρόσβασης
|
||||
Comment[en_GB]=Temporary password caching
|
||||
Comment[eo]=Kaŝmemorado por portempa pasvorto
|
||||
Comment[es]=Cacheo temporal de contraseñas
|
||||
Comment[et]=Ajutine parooli puhverdamine
|
||||
Comment[eu]=Pasahitzak cachean gordetzea aldi baterako
|
||||
Comment[fa]=نهانسازی موقت رمزعبور
|
||||
Comment[fi]=Väliaikainen salasanavälimuisti
|
||||
Comment[fr]=Masquage temporaire du mot de passe
|
||||
Comment[ga]=Taisce Shealadach Focal Faire
|
||||
Comment[gl]=Caché temporal de contrasinais
|
||||
Comment[gu]=કામચલાઉ પાસવર્ડ કેશીંગ
|
||||
Comment[he]=שמירה זמנית של סיסמאות בזיכרון מטמון
|
||||
Comment[hi]=अस्थायी पासवर्ड कैशिंग
|
||||
Comment[hr]=Privremeno spremanje zaporke
|
||||
Comment[hu]=Jelszavak ideiglenes gyorsítótárazása
|
||||
Comment[ia]=Ponente in cache le contrasigno temporari
|
||||
Comment[id]=Penyimpanan sandi temporer
|
||||
Comment[is]=Bráðabirgðavistun lykilorða í skyndiminni
|
||||
Comment[it]=Memorizzazione delle password temporanea
|
||||
Comment[ja]=一時的なパスワードキャッシング
|
||||
Comment[kk]=Паролін уақытша кэштеу
|
||||
Comment[km]=ឃ្លាំងសម្ងាត់ពាក្យសម្ងាត់បណ្ដោះអាសន្ន
|
||||
Comment[kn]=ಗುಪ್ತಪದ (ಪಾಸ್ ವರ್ಡ್) ತತ್ಕಾಲ ಸಂಗ್ರಹಣೆ (ಕ್ಯಾಶಿಂಗ್)
|
||||
Comment[ko]=임시 암호 캐싱
|
||||
Comment[lt]=Laikinas slaptažodžio prisiminimas
|
||||
Comment[lv]=Īslaicīga paroļu atcerēšanās
|
||||
Comment[mai]=अस्थायी गूढ़किल्ली कैशिंग
|
||||
Comment[ml]=താത്കാലികമായി അടയാളവാക്കു് ഓര്ത്തുവയ്ക്കുക
|
||||
Comment[mr]=गुप्तशब्द तात्पूरता आठवणीत ठेवत आहे
|
||||
Comment[nb]=Midlertidig mellomlagring av passord
|
||||
Comment[nds]=Passwöör temporeer twischenspiekern
|
||||
Comment[nl]=Tijdelijke caching van wachtwoorden
|
||||
Comment[nn]=Mellombels lagring av passord
|
||||
Comment[pa]=ਆਰਜੀ ਪਾਸਵਰਡ ਕੈਸ਼ਿੰਗ
|
||||
Comment[pl]=Tymczasowe zapamiętywanie haseł
|
||||
Comment[pt]='Cache' temporária de senhas
|
||||
Comment[pt_BR]=Cache temporária de senhas
|
||||
Comment[ro]=Stocarea temporară a parolelor
|
||||
Comment[ru]=Временное кэширование паролей
|
||||
Comment[si]=තාවකාලික මුරපද කැශ් කිරීම
|
||||
Comment[sk]=Dočasné ukladanie hesiel do vyrovnávacej pamäte
|
||||
Comment[sl]=Začasno predpomnjenje gesel
|
||||
Comment[sr]=Привремено кеширање лозинке
|
||||
Comment[sr@ijekavian]=Привремено кеширање лозинке
|
||||
Comment[sr@ijekavianlatin]=Privremeno keširanje lozinke
|
||||
Comment[sr@latin]=Privremeno keširanje lozinke
|
||||
Comment[sv]=Tillfällig lagring av lösenord
|
||||
Comment[tg]=Захираи пароли муваққатӣ
|
||||
Comment[th]=การจัดเก็บรหัสผ่านชั่วคราว
|
||||
Comment[tr]=Geçici parola önbelleklemesi
|
||||
Comment[ug]=ۋاقىتلىق ئىم غەملەك
|
||||
Comment[uk]=Тимчасове кешування паролів
|
||||
Comment[vi]=Lưu đệm mật khẩu tạm
|
||||
Comment[wa]=Muchete timporaire do scret
|
||||
Comment[x-test]=xxTemporary password cachingxx
|
||||
Comment[zh_CN]=临时性密码缓存
|
||||
Comment[zh_TW]=暫時性的密碼快取
|
||||
X-KDE-ServiceTypes=KDEDModule
|
||||
X-KDE-Library=kpasswdserver
|
||||
X-KDE-DBus-ModuleName=kpasswdserver
|
||||
X-KDE-Kded-autoload=false
|
||||
X-KDE-Kded-load-on-demand=true
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE Password Server
|
||||
|
||||
Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
|
||||
Copyright (C) 2012 Dawit Alemayehu (adawit@kde.org)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2 as published by the Free Software Foundation.
|
||||
|
||||
This software 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 library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// KDE Password Server
|
||||
|
||||
#ifndef KPASSWDSERVER_H
|
||||
#define KPASSWDSERVER_H
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtDBus/QDBusContext>
|
||||
#include <QtDBus/QDBusMessage>
|
||||
#include <qwindowdefs.h>
|
||||
|
||||
#include <kio/authinfo.h>
|
||||
#include <kdedmodule.h>
|
||||
|
||||
namespace KWallet {
|
||||
class Wallet;
|
||||
}
|
||||
|
||||
using namespace KIO;
|
||||
|
||||
class KPasswdServer : public KDEDModule, protected QDBusContext
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KPasswdServer(QObject* parent, const QList<QVariant>& = QList<QVariant>());
|
||||
~KPasswdServer();
|
||||
|
||||
// Called by the unit test
|
||||
void setWalletDisabled(bool d) { m_walletDisabled = d; }
|
||||
|
||||
public Q_SLOTS:
|
||||
qlonglong checkAuthInfoAsync(KIO::AuthInfo, qlonglong, qlonglong);
|
||||
qlonglong queryAuthInfoAsync(const KIO::AuthInfo &, const QString &, qlonglong, qlonglong, qlonglong);
|
||||
void addAuthInfo(const KIO::AuthInfo &, qlonglong);
|
||||
void removeAuthInfo(const QString& host, const QString& protocol, const QString& user);
|
||||
|
||||
// legacy methods provided for compatibility with old clients
|
||||
QByteArray checkAuthInfo(const QByteArray &, qlonglong, qlonglong);
|
||||
QByteArray queryAuthInfo(const QByteArray &, const QString &, qlonglong, qlonglong, qlonglong);
|
||||
void addAuthInfo(const QByteArray &, qlonglong);
|
||||
|
||||
void processRequest();
|
||||
// Remove all authentication info associated with windowId
|
||||
void removeAuthForWindowId(qlonglong windowId);
|
||||
|
||||
Q_SIGNALS:
|
||||
void checkAuthInfoAsyncResult(qlonglong requestId, qlonglong seqNr, const KIO::AuthInfo &);
|
||||
void queryAuthInfoAsyncResult(qlonglong requestId, qlonglong seqNr, const KIO::AuthInfo &);
|
||||
|
||||
private Q_SLOTS:
|
||||
void passwordDialogDone(int);
|
||||
void retryDialogDone(int);
|
||||
void windowRemoved(WId);
|
||||
|
||||
private:
|
||||
struct AuthInfoContainer {
|
||||
AuthInfoContainer() : expire( expNever ), seqNr( 0 ), isCanceled( false ) {}
|
||||
|
||||
KIO::AuthInfo info;
|
||||
QString directory;
|
||||
|
||||
enum { expNever, expWindowClose, expTime } expire;
|
||||
QList<qlonglong> windowList;
|
||||
qulonglong expireTime;
|
||||
qlonglong seqNr;
|
||||
|
||||
bool isCanceled;
|
||||
|
||||
struct Sorter {
|
||||
bool operator() (AuthInfoContainer* n1, AuthInfoContainer* n2) const;
|
||||
};
|
||||
};
|
||||
|
||||
struct Request {
|
||||
bool isAsync; // true for async requests
|
||||
qlonglong requestId; // set for async requests only
|
||||
QDBusMessage transaction; // set for sync requests only
|
||||
QString key;
|
||||
KIO::AuthInfo info;
|
||||
QString errorMsg;
|
||||
qlonglong windowId;
|
||||
qlonglong seqNr;
|
||||
bool prompt;
|
||||
};
|
||||
|
||||
QString createCacheKey( const KIO::AuthInfo &info );
|
||||
const AuthInfoContainer *findAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
|
||||
void removeAuthInfoItem(const QString &key, const KIO::AuthInfo &info);
|
||||
void addAuthInfoItem(const QString &key, const KIO::AuthInfo &info, qlonglong windowId, qlonglong seqNr, bool canceled);
|
||||
void copyAuthInfo(const AuthInfoContainer*, KIO::AuthInfo&);
|
||||
void updateAuthExpire(const QString &key, const AuthInfoContainer *, qlonglong windowId, bool keep);
|
||||
int findWalletEntry( const QMap<QString,QString>& map, const QString& username );
|
||||
bool openWallet( qlonglong windowId );
|
||||
|
||||
bool hasPendingQuery(const QString &key, const KIO::AuthInfo &info);
|
||||
void sendResponse (Request* request);
|
||||
void showPasswordDialog(Request* request);
|
||||
void updateCachedRequestKey(QList<Request*>&, const QString& oldKey, const QString& newKey);
|
||||
|
||||
typedef QList<AuthInfoContainer*> AuthInfoContainerList;
|
||||
QHash<QString, AuthInfoContainerList*> m_authDict;
|
||||
|
||||
QList<Request*> m_authPending;
|
||||
QList<Request*> m_authWait;
|
||||
QHash<int, QStringList> mWindowIdList;
|
||||
QHash<QObject*, Request*> m_authInProgress;
|
||||
QHash<QObject*, Request*> m_authRetryInProgress;
|
||||
QStringList m_authPrompted;
|
||||
KWallet::Wallet* m_wallet;
|
||||
bool m_walletDisabled;
|
||||
qlonglong m_seqNr;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,61 +0,0 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node>
|
||||
<interface name="org.kde.KPasswdServer" >
|
||||
<signal name="checkAuthInfoAsyncResult" >
|
||||
<arg type="x" name="requestId" />
|
||||
<arg type="x" name="seqNr" />
|
||||
<arg type="(ysssssssssbbbba{s(siv)})" name="info" />
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="KIO::AuthInfo" />
|
||||
</signal>
|
||||
<signal name="queryAuthInfoAsyncResult" >
|
||||
<arg type="x" name="requestId" />
|
||||
<arg type="x" name="seqNr" />
|
||||
<arg type="(ysssssssssbbbba{s(siv)})" name="info" />
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="KIO::AuthInfo" />
|
||||
</signal>
|
||||
<method name="checkAuthInfo" >
|
||||
<arg direction="out" type="ay" />
|
||||
<arg direction="in" type="ay" name="data" />
|
||||
<arg direction="in" type="x" name="windowId" />
|
||||
<arg direction="in" type="x" name="usertime" />
|
||||
</method>
|
||||
<method name="queryAuthInfo" >
|
||||
<arg direction="out" type="ay" />
|
||||
<arg direction="in" type="ay" name="data" />
|
||||
<arg direction="in" type="s" name="errorMsg" />
|
||||
<arg direction="in" type="x" name="windowId" />
|
||||
<arg direction="in" type="x" name="seqNr" />
|
||||
<arg direction="in" type="x" name="usertime" />
|
||||
</method>
|
||||
<method name="checkAuthInfoAsync" >
|
||||
<arg direction="out" type="x" />
|
||||
<arg direction="in" type="(ysssssssssbbbba{s(siv)})" name="info" />
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="KIO::AuthInfo" />
|
||||
<arg direction="in" type="x" name="windowId" />
|
||||
<arg direction="in" type="x" name="usertime" />
|
||||
</method>
|
||||
<method name="queryAuthInfoAsync" >
|
||||
<arg direction="out" type="x" />
|
||||
<arg direction="in" type="(ysssssssssbbbba{s(siv)})" name="info" />
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="KIO::AuthInfo" />
|
||||
<arg direction="in" type="s" name="errorMsg" />
|
||||
<arg direction="in" type="x" name="windowId" />
|
||||
<arg direction="in" type="x" name="seqNr" />
|
||||
<arg direction="in" type="x" name="usertime" />
|
||||
</method>
|
||||
<method name="addAuthInfo" >
|
||||
<arg direction="in" type="ay" name="data" />
|
||||
<arg direction="in" type="x" name="windowId" />
|
||||
</method>
|
||||
<method name="addAuthInfo" >
|
||||
<arg direction="in" type="(ysssssssssbbbba{s(siv)})" name="info" />
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="KIO::AuthInfo" />
|
||||
<arg direction="in" type="x" name="windowId" />
|
||||
</method>
|
||||
<method name="removeAuthInfo" >
|
||||
<arg direction="in" type="s" name="host" />
|
||||
<arg direction="in" type="s" name="protocol" />
|
||||
<arg direction="in" type="s" name="user" />
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
|
@ -1,19 +0,0 @@
|
|||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
)
|
||||
|
||||
set (kpasswdserver_test_SRCS
|
||||
kpasswdservertest.cpp
|
||||
../kpasswdserver.cpp
|
||||
)
|
||||
|
||||
qt4_add_dbus_adaptor(kpasswdserver_test_SRCS ../org.kde.KPasswdServer.xml kpasswdserver.h KPasswdServer)
|
||||
|
||||
kde4_add_test(kpasswdservertest ${kpasswdserver_test_SRCS})
|
||||
target_link_libraries(kpasswdservertest
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${KDE4_KIO_LIBS}
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTTEST_LIBRARY}
|
||||
)
|
|
@ -1,554 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright 2010 David Faure <faure@kde.org>
|
||||
Copyright 2012 Dawit Alemayehu <adawit@kde.org>
|
||||
|
||||
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 ) version 3 or, at the discretion of KDE e.V. ( which shall
|
||||
act as a proxy as in section 14 of the GPLv3 ), 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, see <http://www.gnu.org/licenses/>.
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kpassworddialog.h>
|
||||
#include <QApplication>
|
||||
#include <qtest_kde.h>
|
||||
#include <kpasswdserver.h>
|
||||
|
||||
static const char* sigQueryAuthInfoResult = SIGNAL(queryAuthInfoAsyncResult(qlonglong,qlonglong,KIO::AuthInfo));
|
||||
static const char* sigCheckAuthInfoResult = SIGNAL(checkAuthInfoAsyncResult(qlonglong,qlonglong,KIO::AuthInfo));
|
||||
|
||||
static QString getUserNameFrom(const KIO::AuthInfo& auth)
|
||||
{
|
||||
if (auth.username.isEmpty() && !auth.url.user().isEmpty()) {
|
||||
return auth.url.user();
|
||||
}
|
||||
|
||||
return auth.username;
|
||||
}
|
||||
|
||||
class KPasswdServerTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
void simpleTest()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
// Check that processRequest doesn't crash when it has nothing to do
|
||||
server.processRequest();
|
||||
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com");
|
||||
|
||||
// Make a check for that host, should say "not found"
|
||||
QVERIFY(noCheckAuth(server, info));
|
||||
|
||||
// Now add auth to the cache
|
||||
const qlonglong windowId = 42;
|
||||
KIO::AuthInfo realInfo = info;
|
||||
realInfo.username = "toto"; // you can see I'm french
|
||||
realInfo.password = "foobar";
|
||||
server.addAuthInfo(realInfo, windowId); // seqnr=2
|
||||
|
||||
// queryAuth without the ability to prompt, will just return info unmodified
|
||||
KIO::AuthInfo resultInfo;
|
||||
queryAuth(server, info, resultInfo);
|
||||
QCOMPARE(resultInfo.url, info.url);
|
||||
QCOMPARE(resultInfo.username, QString());
|
||||
QCOMPARE(resultInfo.password, QString());
|
||||
QCOMPARE(resultInfo.isModified(), false);
|
||||
|
||||
// Check that checkAuth finds it
|
||||
QVERIFY(successCheckAuth(server, info, realInfo));
|
||||
|
||||
// Now remove auth
|
||||
server.removeAuthInfo(info.url.host(), info.url.protocol(), info.username);
|
||||
// Check we can't find that auth anymore
|
||||
QVERIFY(noCheckAuth(server, info));
|
||||
}
|
||||
|
||||
void testCheckDuringQuery()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.kde.org");
|
||||
|
||||
// Start a query
|
||||
QSignalSpy spyQuery(&server, sigQueryAuthInfoResult);
|
||||
const qlonglong windowId = 42;
|
||||
const qlonglong seqNr = 2;
|
||||
const qlonglong id = server.queryAuthInfoAsync(
|
||||
info,
|
||||
QString("<NoAuthPrompt>"), // magic string to avoid a dialog
|
||||
windowId, seqNr, 16 /*usertime*/);
|
||||
|
||||
// Before it is processed, do a check, it will reply delayed.
|
||||
QSignalSpy spyCheck(&server, sigCheckAuthInfoResult);
|
||||
const qlonglong idCheck = server.checkAuthInfoAsync(info, windowId, 17 /*usertime*/);
|
||||
QCOMPARE(idCheck, 0LL); // always
|
||||
QCOMPARE(spyCheck.count(), 0); // no reply yet
|
||||
|
||||
// Wait for the query to be processed
|
||||
QVERIFY(QTest::kWaitForSignal(&server, sigQueryAuthInfoResult, 1000));
|
||||
QCOMPARE(spyQuery.count(), 1);
|
||||
QCOMPARE(spyQuery[0][0].toLongLong(), id);
|
||||
KIO::AuthInfo result = spyQuery[0][2].value<KIO::AuthInfo>();
|
||||
|
||||
// Now the check will have replied
|
||||
QCOMPARE(spyCheck.count(), 1);
|
||||
QCOMPARE(spyCheck[0][0].toLongLong(), id+1); // it was the next request after the query
|
||||
KIO::AuthInfo resultCheck = spyCheck[0][2].value<KIO::AuthInfo>();
|
||||
QCOMPARE(result.username, resultCheck.username);
|
||||
QCOMPARE(result.password, resultCheck.password);
|
||||
}
|
||||
|
||||
void testExpiry()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com");
|
||||
|
||||
// Add auth to the cache
|
||||
const qlonglong windowId = 42;
|
||||
KIO::AuthInfo realInfo = info;
|
||||
realInfo.username = "toto";
|
||||
realInfo.password = "foobar";
|
||||
server.addAuthInfo(realInfo, windowId);
|
||||
|
||||
QVERIFY(successCheckAuth(server, info, realInfo));
|
||||
|
||||
// Close another window, shouldn't hurt
|
||||
server.removeAuthForWindowId(windowId + 1);
|
||||
QVERIFY(successCheckAuth(server, info, realInfo));
|
||||
|
||||
// Close window
|
||||
server.removeAuthForWindowId(windowId);
|
||||
|
||||
// Check we can't find that auth anymore
|
||||
QVERIFY(noCheckAuth(server, info));
|
||||
}
|
||||
|
||||
void testFillDialog()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
// What the app would ask
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com");
|
||||
|
||||
// What the user would type
|
||||
KIO::AuthInfo filledInfo(info);
|
||||
filledInfo.username = "dfaure";
|
||||
filledInfo.password = "toto";
|
||||
|
||||
KIO::AuthInfo result;
|
||||
queryAuthWithDialog(server, info, filledInfo, result);
|
||||
}
|
||||
|
||||
void testRejectRetryDialog()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
// What the app would ask
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com");
|
||||
|
||||
// What the user would type
|
||||
KIO::AuthInfo filledInfo(info);
|
||||
filledInfo.username = "username";
|
||||
filledInfo.password = "password";
|
||||
|
||||
KIO::AuthInfo result;
|
||||
queryAuthWithDialog(server, info, filledInfo, result);
|
||||
|
||||
// Pretend that the returned credentials failed and initiate a retry,
|
||||
// but cancel the retry dialog.
|
||||
info.password.clear();
|
||||
result = KIO::AuthInfo();
|
||||
queryAuthWithDialog(server, info, filledInfo, result, QDialog::Rejected, QLatin1String("Invalid username or password"));
|
||||
}
|
||||
|
||||
void testAcceptRetryDialog()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
// What the app would ask
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com");
|
||||
|
||||
// What the user would type
|
||||
KIO::AuthInfo filledInfo(info);
|
||||
filledInfo.username = "username";
|
||||
filledInfo.password = "password";
|
||||
|
||||
KIO::AuthInfo result;
|
||||
queryAuthWithDialog(server, info, filledInfo, result);
|
||||
|
||||
// Pretend that the returned credentials failed and initiate a retry,
|
||||
// but this time continue the retry.
|
||||
info.password.clear();
|
||||
result = KIO::AuthInfo();
|
||||
queryAuthWithDialog(server, info, filledInfo, result, QDialog::Accepted, QLatin1String("Invalid username or password"));
|
||||
}
|
||||
|
||||
void testUsernameMistmatch()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
// What the app would ask. Note the username in the URL.
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://foo@www.example.com");
|
||||
|
||||
// What the user would type
|
||||
KIO::AuthInfo filledInfo(info);
|
||||
filledInfo.username = "bar";
|
||||
filledInfo.password = "blah";
|
||||
|
||||
KIO::AuthInfo result;
|
||||
queryAuthWithDialog(server, info, filledInfo, result);
|
||||
|
||||
// Check the returned url does not match the request url because of the
|
||||
// username mismatch between the request URL and the filled in one.
|
||||
QVERIFY(result.url != filledInfo.url);
|
||||
|
||||
// Verify there is NO cached auth data if the request URL contains the
|
||||
// original user name (foo).
|
||||
QVERIFY(noCheckAuth(server, info));
|
||||
|
||||
// Verify there is a cached auth data if the request URL contains the
|
||||
// new user name (bar).
|
||||
filledInfo.url = KUrl("http://bar@www.example.com");
|
||||
QVERIFY(successCheckAuth(server, filledInfo, result));
|
||||
|
||||
// Now the URL check should be valid too.
|
||||
QCOMPARE(result.url, filledInfo.url);
|
||||
}
|
||||
|
||||
void testCancelPasswordDialog()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
// What the app would ask.
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com");
|
||||
info.username = info.url.user();
|
||||
|
||||
KIO::AuthInfo result;
|
||||
queryAuthWithDialog(server, info, KIO::AuthInfo(), result, QDialog::Rejected);
|
||||
}
|
||||
|
||||
void testVerifyPath()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
// Add auth to the cache
|
||||
const qlonglong windowId = 42;
|
||||
KIO::AuthInfo authInfo;
|
||||
authInfo.url = KUrl("http://www.example.com/test/test.html");
|
||||
authInfo.username = "toto";
|
||||
authInfo.password = "foobar";
|
||||
server.addAuthInfo(authInfo, windowId);
|
||||
|
||||
KIO::AuthInfo queryAuthInfo;
|
||||
queryAuthInfo.url = KUrl("http://www.example.com/test/test2/test.html");
|
||||
queryAuthInfo.verifyPath = true;
|
||||
|
||||
KIO::AuthInfo expectedAuthInfo;
|
||||
expectedAuthInfo.username = "toto";
|
||||
expectedAuthInfo.password = "foobar";
|
||||
|
||||
QVERIFY(successCheckAuth(server, queryAuthInfo, expectedAuthInfo));
|
||||
}
|
||||
|
||||
void testConcurrentQueryAuth()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
QList<KIO::AuthInfo> authInfos;
|
||||
for (int i=0; i < 10; ++i) {
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com/test" + QString::number(i) + ".html");
|
||||
authInfos << info;
|
||||
}
|
||||
|
||||
// What the user would type
|
||||
KIO::AuthInfo filledInfo;
|
||||
filledInfo.username = "bar";
|
||||
filledInfo.password = "blah";
|
||||
|
||||
QList<KIO::AuthInfo> results;
|
||||
concurrentQueryAuthWithDialog(server, authInfos, filledInfo, results);
|
||||
}
|
||||
|
||||
void testConcurrentCheckAuth()
|
||||
{
|
||||
KPasswdServer server(this);
|
||||
server.setWalletDisabled(true);
|
||||
|
||||
QList<KIO::AuthInfo> authInfos;
|
||||
for (int i=0; i < 10; ++i) {
|
||||
KIO::AuthInfo info;
|
||||
info.url = KUrl("http://www.example.com/test" + QString::number(i) + ".html");
|
||||
authInfos << info;
|
||||
}
|
||||
|
||||
// What the user would type
|
||||
KIO::AuthInfo filledInfo;
|
||||
filledInfo.username = "bar";
|
||||
filledInfo.password = "blah";
|
||||
|
||||
QList<KIO::AuthInfo> results;
|
||||
concurrentQueryAuthWithDialog(server, authInfos, filledInfo, results);
|
||||
}
|
||||
|
||||
private:
|
||||
// Checks that no auth is available for @p info
|
||||
bool noCheckAuth(KPasswdServer& server, const KIO::AuthInfo& info)
|
||||
{
|
||||
KIO::AuthInfo result;
|
||||
checkAuth(server, info, result);
|
||||
return (result.username == info.username)
|
||||
&& (result.password == info.password)
|
||||
&& !result.isModified();
|
||||
}
|
||||
|
||||
// Check that the auth is available and equal to @expectedInfo
|
||||
bool successCheckAuth(KPasswdServer& server, const KIO::AuthInfo& info, const KIO::AuthInfo& expectedInfo)
|
||||
{
|
||||
KIO::AuthInfo result;
|
||||
checkAuth(server, info, result);
|
||||
return (result.username == expectedInfo.username)
|
||||
&& (result.password == expectedInfo.password)
|
||||
&& result.isModified();
|
||||
}
|
||||
|
||||
void checkAuth(KPasswdServer& server, const KIO::AuthInfo& info, KIO::AuthInfo& result)
|
||||
{
|
||||
QSignalSpy spy(&server, sigCheckAuthInfoResult);
|
||||
const qlonglong windowId = 42;
|
||||
const qlonglong id = server.checkAuthInfoAsync(info, windowId, 17 /*usertime*/);
|
||||
QCOMPARE(id, 0LL); // always
|
||||
if (spy.isEmpty()) {
|
||||
QVERIFY(QTest::kWaitForSignal(&server, sigCheckAuthInfoResult, 1000));
|
||||
}
|
||||
QCOMPARE(spy.count(), 1);
|
||||
// kpasswdserver emits a requestId via dbus, we can't get that id here
|
||||
QVERIFY(spy[0][0].toLongLong() >= 0);
|
||||
//QCOMPARE(spy[0][1].toLongLong(), 3LL); // seqNr
|
||||
result = spy[0][2].value<KIO::AuthInfo>();
|
||||
}
|
||||
|
||||
void queryAuth(KPasswdServer& server, const KIO::AuthInfo& info, KIO::AuthInfo& result)
|
||||
{
|
||||
QSignalSpy spy(&server, sigQueryAuthInfoResult);
|
||||
const qlonglong windowId = 42;
|
||||
const qlonglong seqNr = 2;
|
||||
const qlonglong id = server.queryAuthInfoAsync(
|
||||
info,
|
||||
QString("<NoAuthPrompt>"), // magic string to avoid a dialog
|
||||
windowId, seqNr, 16 /*usertime*/);
|
||||
QVERIFY(id >= 0); // requestId, ever increasing
|
||||
if (spy.isEmpty())
|
||||
QVERIFY(QTest::kWaitForSignal(&server, sigQueryAuthInfoResult, 1000));
|
||||
QCOMPARE(spy.count(), 1);
|
||||
QCOMPARE(spy[0][0].toLongLong(), id);
|
||||
//QCOMPARE(spy[0][1].toLongLong(), 3LL); // seqNr
|
||||
result = spy[0][2].value<KIO::AuthInfo>();
|
||||
}
|
||||
|
||||
void queryAuthWithDialog(KPasswdServer& server, const KIO::AuthInfo& info,
|
||||
const KIO::AuthInfo& filledInfo, KIO::AuthInfo& result,
|
||||
int code = QDialog::Accepted, const QString& errMsg = QString())
|
||||
{
|
||||
QSignalSpy spy(&server, sigQueryAuthInfoResult);
|
||||
const qlonglong windowId = 42;
|
||||
const qlonglong seqNr = 2;
|
||||
const qlonglong id = server.queryAuthInfoAsync(
|
||||
info,
|
||||
errMsg,
|
||||
windowId, seqNr, 16 /*usertime*/);
|
||||
QVERIFY(id >= 0); // requestId, ever increasing
|
||||
QVERIFY(spy.isEmpty());
|
||||
|
||||
const bool hasErrorMessage = (!errMsg.isEmpty());
|
||||
const bool isCancelRetryDialogTest = (hasErrorMessage && code == QDialog::Rejected);
|
||||
|
||||
if (hasErrorMessage) {
|
||||
// Retry dialog only knows Yes/No
|
||||
const int retryCode = (code == QDialog::Accepted ? KDialog::Yes : KDialog::No);
|
||||
QMetaObject::invokeMethod(this, "checkRetryDialog",
|
||||
Qt::QueuedConnection, Q_ARG(int, retryCode));
|
||||
}
|
||||
|
||||
if (!isCancelRetryDialogTest) {
|
||||
QMetaObject::invokeMethod(this, "checkAndFillDialog", Qt::QueuedConnection,
|
||||
Q_ARG(KIO::AuthInfo, info),
|
||||
Q_ARG(KIO::AuthInfo, filledInfo),
|
||||
Q_ARG(int, code));
|
||||
}
|
||||
// Force KPasswdServer to process the request now, otherwise the checkAndFillDialog needs a timer too...
|
||||
server.processRequest();
|
||||
if (spy.isEmpty())
|
||||
QVERIFY(QTest::kWaitForSignal(&server, sigQueryAuthInfoResult, 1000));
|
||||
QCOMPARE(spy.count(), 1);
|
||||
QCOMPARE(spy[0][0].toLongLong(), id);
|
||||
//QCOMPARE(spy[0][1].toLongLong(), 3LL); // seqNr
|
||||
result = spy[0][2].value<KIO::AuthInfo>();
|
||||
const QString username = (isCancelRetryDialogTest ? QString() : filledInfo.username);
|
||||
const QString password = (isCancelRetryDialogTest ? QString() : filledInfo.password);
|
||||
const bool modified = (code == QDialog::Accepted ? true : false);
|
||||
QCOMPARE(result.username, username);
|
||||
QCOMPARE(result.password, password);
|
||||
QCOMPARE(result.isModified(), modified);
|
||||
}
|
||||
|
||||
void concurrentQueryAuthWithDialog(KPasswdServer& server, const QList<KIO::AuthInfo>& infos,
|
||||
const KIO::AuthInfo& filledInfo, QList<KIO::AuthInfo>& results,
|
||||
int code = QDialog::Accepted)
|
||||
{
|
||||
QSignalSpy spy(&server, sigQueryAuthInfoResult);
|
||||
const qlonglong windowId = 42;
|
||||
qlonglong seqNr = 0;
|
||||
QList<qlonglong> idList;
|
||||
|
||||
Q_FOREACH(const KIO::AuthInfo& info, infos) {
|
||||
const qlonglong id = server.queryAuthInfoAsync(
|
||||
info,
|
||||
QString(),
|
||||
windowId, seqNr, 16 /*usertime*/);
|
||||
QVERIFY(id >= 0); // requestId, ever increasing
|
||||
idList << id;
|
||||
}
|
||||
|
||||
QVERIFY(spy.isEmpty());
|
||||
QMetaObject::invokeMethod(this, "checkAndFillDialog", Qt::QueuedConnection,
|
||||
Q_ARG(KIO::AuthInfo, infos.first()),
|
||||
Q_ARG(KIO::AuthInfo,filledInfo),
|
||||
Q_ARG(int, code));
|
||||
|
||||
// Force KPasswdServer to process the request now, otherwise the checkAndFillDialog needs a timer too...
|
||||
server.processRequest();
|
||||
while (spy.count() < infos.count())
|
||||
QVERIFY(QTest::kWaitForSignal(&server, sigQueryAuthInfoResult, 1000));
|
||||
|
||||
QCOMPARE(spy.count(), infos.count());
|
||||
|
||||
for(int i = 0, count = spy.count(); i < count; ++i) {
|
||||
QCOMPARE(spy[i][0].toLongLong(), idList.at(i));
|
||||
//QCOMPARE(spy[0][1].toLongLong(), 3LL); // seqNr
|
||||
KIO::AuthInfo result = spy[i][2].value<KIO::AuthInfo>();
|
||||
QCOMPARE(result.username, filledInfo.username);
|
||||
QCOMPARE(result.password, filledInfo.password);
|
||||
QCOMPARE(result.isModified(), (code == QDialog::Accepted ? true : false));
|
||||
results << result;
|
||||
}
|
||||
}
|
||||
|
||||
void concurrentCheckAuthWithDialog(KPasswdServer& server, const QList<KIO::AuthInfo>& infos,
|
||||
const KIO::AuthInfo& filledInfo, QList<KIO::AuthInfo>& results,
|
||||
int code = QDialog::Accepted)
|
||||
{
|
||||
QSignalSpy spy(&server, sigQueryAuthInfoResult);
|
||||
const qlonglong windowId = 42;
|
||||
qlonglong seqNr = 0;
|
||||
QList<qlonglong> idList;
|
||||
|
||||
QListIterator<KIO::AuthInfo> it (infos);
|
||||
if (it.hasNext()) {
|
||||
const qlonglong id = server.queryAuthInfoAsync(
|
||||
it.next(),
|
||||
QString(),
|
||||
windowId, seqNr, 16 /*usertime*/);
|
||||
QVERIFY(id >= 0); // requestId, ever increasing
|
||||
idList << id;
|
||||
}
|
||||
|
||||
while (it.hasNext()) {
|
||||
const qlonglong id = server.checkAuthInfoAsync(it.next(), windowId,16 /*usertime*/);
|
||||
QVERIFY(id >= 0); // requestId, ever increasing
|
||||
idList << id;
|
||||
}
|
||||
|
||||
QVERIFY(spy.isEmpty());
|
||||
QMetaObject::invokeMethod(this, "checkAndFillDialog", Qt::QueuedConnection,
|
||||
Q_ARG(KIO::AuthInfo, infos.first()),
|
||||
Q_ARG(KIO::AuthInfo,filledInfo),
|
||||
Q_ARG(int, code));
|
||||
|
||||
// Force KPasswdServer to process the request now, otherwise the checkAndFillDialog needs a timer too...
|
||||
server.processRequest();
|
||||
if (spy.isEmpty())
|
||||
QVERIFY(QTest::kWaitForSignal(&server, sigQueryAuthInfoResult, 1000));
|
||||
|
||||
while ((spy.count()-1) < infos.count()) {
|
||||
QVERIFY(QTest::kWaitForSignal(&server, sigCheckAuthInfoResult, 1000));
|
||||
}
|
||||
|
||||
for(int i = 0, count = spy.count(); i < count; ++i) {
|
||||
QCOMPARE(spy[i][0].toLongLong(), idList.at(i));
|
||||
//QCOMPARE(spy[0][1].toLongLong(), 3LL); // seqNr
|
||||
KIO::AuthInfo result = spy[i][2].value<KIO::AuthInfo>();
|
||||
QCOMPARE(result.username, filledInfo.username);
|
||||
QCOMPARE(result.password, filledInfo.password);
|
||||
QCOMPARE(result.isModified(), (code == QDialog::Accepted ? true : false));
|
||||
results << result;
|
||||
}
|
||||
}
|
||||
|
||||
protected Q_SLOTS:
|
||||
void checkAndFillDialog(const KIO::AuthInfo& info, const KIO::AuthInfo& filledInfo, int code = QDialog::Accepted)
|
||||
{
|
||||
Q_FOREACH(QWidget *widget, QApplication::topLevelWidgets()) {
|
||||
if (KPasswordDialog* dialog = qobject_cast<KPasswordDialog *>(widget)) {
|
||||
if (code == QDialog::Accepted) {
|
||||
QCOMPARE(dialog->username(), getUserNameFrom(info));
|
||||
QCOMPARE(dialog->password(), info.password);
|
||||
dialog->setUsername(filledInfo.username);
|
||||
dialog->setPassword(filledInfo.password);
|
||||
}
|
||||
dialog->done(code);
|
||||
return;
|
||||
}
|
||||
}
|
||||
kWarning() << "No KPasswordDialog found!";
|
||||
}
|
||||
|
||||
void checkRetryDialog(int code = QDialog::Accepted)
|
||||
{
|
||||
Q_FOREACH(QWidget *widget, QApplication::topLevelWidgets()) {
|
||||
KDialog* dialog = qobject_cast<KDialog*>(widget);
|
||||
if (dialog && !dialog->inherits("KPasswordDialog")) {
|
||||
dialog->done(code);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_KDEMAIN( KPasswdServerTest, GUI )
|
||||
|
||||
#include "kpasswdservertest.moc"
|
|
@ -1,53 +0,0 @@
|
|||
project(kwalletd)
|
||||
|
||||
########### build backends #########
|
||||
add_subdirectory(backend)
|
||||
|
||||
########### kwalletd ###############
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/backend
|
||||
${CMAKE_CURRENT_BINARY_DIR}/backend
|
||||
)
|
||||
|
||||
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=285)
|
||||
|
||||
set(kwalletd_SRCS
|
||||
main.cpp
|
||||
kbetterthankdialog.cpp
|
||||
kwalletd.cpp
|
||||
kwalletwizard.cpp
|
||||
ktimeout.cpp
|
||||
kwalletsessionstore.cpp
|
||||
kbetterthankdialogbase.ui
|
||||
kwalletwizardpageexplanation.ui
|
||||
kwalletwizardpageintro.ui
|
||||
kwalletwizardpageoptions.ui
|
||||
kwalletwizardpagepassword.ui
|
||||
)
|
||||
|
||||
find_file(kwallet_xml org.kde.KWallet.xml HINTS ${KDE4_DBUS_INTERFACES_INSTALL_DIR} )
|
||||
|
||||
qt4_add_dbus_adaptor( kwalletd_SRCS ${kwallet_xml} kwalletd.h KWalletD )
|
||||
|
||||
dbus_add_activation_service(org.kde.kwalletd.service.in)
|
||||
|
||||
add_executable( kwalletd ${kwalletd_SRCS} )
|
||||
|
||||
target_link_libraries(kwalletd
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${SOCKET_LIBRARIES}
|
||||
kwalletbackend
|
||||
)
|
||||
|
||||
install(TARGETS kwalletd ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install( FILES kwalletd.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR} )
|
||||
install( FILES kwalletd.notifyrc DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwalletd )
|
||||
|
||||
if(ENABLE_TESTING)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(autotests)
|
||||
endif()
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
|
||||
$XGETTEXT `find . -name "*.cpp" -o -name "*.cc" | grep -v "/tests"` -o $podir/kwalletd.pot
|
|
@ -1,19 +0,0 @@
|
|||
This directory consists of one daemon: kwalletd, and one library, in backend.
|
||||
|
||||
KWallet::Backend is used inside kwalletd to manage the actual files and
|
||||
encryption.
|
||||
|
||||
KWallet::Wallet, used to represent wallet entries and to encapsulate communication
|
||||
to and from the wallet server kwalletd, is part of the public API and has been
|
||||
moved to kdeui.
|
||||
|
||||
|
||||
Application level:
|
||||
|
||||
KSystemTray notifier for wallet accesses
|
||||
|
||||
Konqueror plugin
|
||||
|
||||
KControl module
|
||||
|
||||
You can also read the paper at http://www.staikos.net/~staikos/papers/2003/
|
|
@ -1,11 +0,0 @@
|
|||
add_definitions(-DTEST_DATA="\\\"${CMAKE_CURRENT_SOURCE_DIR}/\\\"")
|
||||
|
||||
set(testname testpamopen)
|
||||
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
kde4_add_test(kwalletd-${testname} kwalletexecuter.cpp ${testname}.cpp)
|
||||
target_link_libraries(kwalletd-${testname} ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${KDE4_KDECORE_LIBS})
|
||||
|
||||
set(testname testpamopennofile)
|
||||
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
kde4_add_test(kwalletd-${testname} kwalletexecuter.cpp ${testname}.cpp)
|
||||
target_link_libraries(kwalletd-${testname} ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${KDE4_KDECORE_LIBS})
|
Binary file not shown.
|
@ -1,205 +0,0 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2014 by Alejandro Fiestas Olivares <afiestas@kde.org> *
|
||||
* *
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
||||
*************************************************************************************/
|
||||
|
||||
#include "kwalletexecuter.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <QTest>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QEventLoop>
|
||||
#include <QtNetwork/QLocalSocket>
|
||||
#include <QtDBus/QDBusMessage>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusServiceWatcher>
|
||||
#include <QtDBus/QDBusConnectionInterface>
|
||||
#include <kconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kstandarddirs.h>
|
||||
|
||||
extern char **environ;
|
||||
|
||||
KWalletExecuter::KWalletExecuter(QObject* parent): QObject(parent)
|
||||
{
|
||||
// Make sure wallet is enabled, otherwise test will fail
|
||||
KConfig cfg("kwalletrc");
|
||||
KConfigGroup cg( &cfg, "Wallet");
|
||||
cg.writeEntry("First Use", false);
|
||||
cg.writeEntry("Enabled", true);
|
||||
}
|
||||
|
||||
void KWalletExecuter::pamOpen()
|
||||
{
|
||||
QDBusMessage msg =
|
||||
QDBusMessage::createMethodCall("org.kde.kwalletd", "/modules/kwalletd", "org.kde.KWallet", "open");
|
||||
QVariantList args;
|
||||
qlonglong wid = 0;
|
||||
args << QLatin1String("kdewallet") << wid << QLatin1String("buh");
|
||||
msg.setArguments(args);
|
||||
const QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
|
||||
|
||||
QVERIFY2(reply.type() != QDBusMessage::ErrorMessage, reply.errorMessage().toLocal8Bit());
|
||||
m_handler = reply.arguments().first().toInt();
|
||||
if (m_handler <= 0) {
|
||||
qFatal("Couldn't open the wallet via dbus");//We don't want the test to continue
|
||||
}
|
||||
}
|
||||
|
||||
void KWalletExecuter::pamWrite(const QString &value) const
|
||||
{
|
||||
QDBusMessage msg =
|
||||
QDBusMessage::createMethodCall("org.kde.kwalletd", "/modules/kwalletd", "org.kde.KWallet", "writePassword");
|
||||
QVariantList args;
|
||||
args << m_handler
|
||||
<< QLatin1String("Passwords")
|
||||
<< QLatin1String("foo")
|
||||
<< value
|
||||
<< QLatin1String("buh");
|
||||
msg.setArguments(args);
|
||||
const QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
|
||||
|
||||
QVERIFY2(reply.type() != QDBusMessage::ErrorMessage, reply.errorMessage().toLocal8Bit());
|
||||
int ret = reply.arguments().first().toInt();
|
||||
QCOMPARE(ret, 0);
|
||||
}
|
||||
|
||||
void KWalletExecuter::pamRead(const QString &value) const
|
||||
{
|
||||
QDBusMessage msg =
|
||||
QDBusMessage::createMethodCall("org.kde.kwalletd", "/modules/kwalletd", "org.kde.KWallet", "readPassword");
|
||||
QVariantList args;
|
||||
args << m_handler
|
||||
<< QLatin1String("Passwords")
|
||||
<< QLatin1String("foo")
|
||||
<< QLatin1String("buh");
|
||||
msg.setArguments(args);
|
||||
const QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
|
||||
|
||||
QVERIFY2(reply.type() != QDBusMessage::ErrorMessage, reply.errorMessage().toLocal8Bit());
|
||||
const QString password = reply.arguments().first().toString();
|
||||
QCOMPARE(password, value);
|
||||
}
|
||||
|
||||
void KWalletExecuter::execute_kwallet(int toWalletPipe[2], int envSocket)
|
||||
{
|
||||
int x = 3;
|
||||
//Close fd that are not of interest of kwallet
|
||||
for (; x < 64; ++x) {
|
||||
if (x != toWalletPipe[0] && x != envSocket) {
|
||||
close (x);
|
||||
}
|
||||
}
|
||||
|
||||
close (toWalletPipe[1]);
|
||||
|
||||
char pipeInt[2];
|
||||
sprintf(pipeInt, "%d", toWalletPipe[0]);
|
||||
char sockIn[2];
|
||||
sprintf(sockIn, "%d", envSocket);
|
||||
|
||||
qDebug() << "Executing kwalletd";
|
||||
QByteArray wallet = KStandardDirs::findExe("kwalletd").toLocal8Bit();
|
||||
char *args[] = {wallet.data(), (char*)"--pam-login", pipeInt, sockIn, NULL};
|
||||
execve(args[0], args, environ);
|
||||
qFatal("Couldn't execute kwalletd");
|
||||
}
|
||||
|
||||
void KWalletExecuter::execute()
|
||||
{
|
||||
//Preparing sockets, we will share them with kwalletd
|
||||
int toWalletPipe[2] = { -1, -1};
|
||||
if (pipe(toWalletPipe) < 0) {
|
||||
qFatal("Couldn't craete pipes");
|
||||
}
|
||||
|
||||
int envSocket;
|
||||
if ((envSocket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
||||
qFatal("Couldn't create socket");
|
||||
}
|
||||
|
||||
QByteArray sock = KStandardDirs::locateLocal("socket", QLatin1String("test.socket")).toLocal8Bit();
|
||||
struct sockaddr_un local;
|
||||
local.sun_family = AF_UNIX;
|
||||
strcpy(local.sun_path, sock.constData());
|
||||
unlink(local.sun_path);//Just in case it exists from a previous login
|
||||
|
||||
int len;
|
||||
len = strlen(local.sun_path) + sizeof(local.sun_family);
|
||||
if (bind(envSocket, (struct sockaddr *)&local, len) == -1) {
|
||||
qFatal("Couldn't bind the socket");
|
||||
}
|
||||
|
||||
if (listen(envSocket, 5) == -1) {
|
||||
qFatal("Couldn't listen into the socket");
|
||||
}
|
||||
|
||||
qputenv("PAM_KWALLET_LOGIN", "1");
|
||||
pid_t pid;
|
||||
switch (pid = fork ()) {
|
||||
case -1: {
|
||||
qFatal("Couldn't fork to execv kwalletd");
|
||||
break;
|
||||
}
|
||||
|
||||
// Child fork, will contain kwalletd
|
||||
case 0: {
|
||||
execute_kwallet(toWalletPipe, envSocket);
|
||||
/* Should never be reached */
|
||||
break;
|
||||
}
|
||||
|
||||
// Parent
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
close(toWalletPipe[0]);//Read end of the pipe, we will only use the write
|
||||
|
||||
QByteArray hash =
|
||||
QByteArray::fromHex("1f1e7736894243657ef4a5274211b9a62703494c286e1699418a36e7ecf31d37319644db63d9fb26eb57cd9b7fea3e88bc18312480ba54f4");
|
||||
write(toWalletPipe[1], hash.constData(), 56);
|
||||
|
||||
QLocalSocket *socket = new QLocalSocket(this);
|
||||
socket->connectToServer(sock);
|
||||
//No need to send any environment vars, the env is already ok
|
||||
socket->close();
|
||||
|
||||
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kwalletd")) {
|
||||
qDebug() << "AAAAAAAA";
|
||||
QEventLoop loop;
|
||||
QTimer::singleShot(30000, &loop, SLOT(quit()));
|
||||
QDBusServiceWatcher *watcher = new QDBusServiceWatcher("org.kde.kwalletd",
|
||||
QDBusConnection::sessionBus(),
|
||||
QDBusServiceWatcher::WatchForRegistration);
|
||||
connect(watcher, SIGNAL(serviceRegistered(QString)), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void KWalletExecuter::cleanupTestCase()
|
||||
{
|
||||
QDBusMessage msg =
|
||||
QDBusMessage::createMethodCall("org.kde.kwalletd", "/MainApplication", "org.kde.KApplication", "quit");
|
||||
const QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
|
||||
|
||||
Q_ASSERT(reply.type() != QDBusMessage::ErrorMessage);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2014 by Alejandro Fiestas Olivares <afiestas@kde.org> *
|
||||
* *
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
||||
*************************************************************************************/
|
||||
|
||||
#ifndef KWALLET_EXECUTER
|
||||
#define KWALLET_EXECUTER
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtDBus/QDBusMessage>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
/**
|
||||
* Executes kwalletd exactly in the same way it is executed in the pam module.
|
||||
* This makes the integration test closer to the real thing.
|
||||
*/
|
||||
class KWalletExecuter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
KWalletExecuter(QObject *parent=0);
|
||||
void execute();
|
||||
void pamOpen();
|
||||
void pamWrite(const QString &value) const;
|
||||
void pamRead(const QString &value) const;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void cleanupTestCase();
|
||||
|
||||
private:
|
||||
void execute_kwallet(int toWalletPipe[2], int envSocket);
|
||||
|
||||
int m_handler;
|
||||
};
|
||||
#endif //KWALLET_EXECUTER
|
|
@ -1,48 +0,0 @@
|
|||
|
||||
#ifndef KWALLET_CUSTOM_QTEST
|
||||
#define KWALLET_CUSTOM_QTEST
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtCore/qdir.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kglobal.h>
|
||||
#include <kurl.h>
|
||||
|
||||
#define QTEST_KDEMAIN_CORE_WITH_DBUS_DAEMON(TestObject) \
|
||||
int main(int argc, char *argv[]) \
|
||||
{ \
|
||||
setenv("LC_ALL", "C", 1); \
|
||||
assert( !QDir::homePath().isEmpty() ); \
|
||||
setenv("KDEHOME", QFile::encodeName( QDir::homePath() + QString::fromLatin1("/.kde-unit-test" )), 1); \
|
||||
setenv("XDG_DATA_HOME", QFile::encodeName( QDir::homePath() + QString::fromLatin1("/.kde-unit-test/xdg/local") ), 1); \
|
||||
setenv("XDG_CONFIG_HOME", QFile::encodeName( QDir::homePath() + QString::fromLatin1("/.kde-unit-test/xdg/config") ), 1); \
|
||||
unsetenv("KDE_COLOR_DEBUG"); \
|
||||
QFile::remove(QDir::homePath() + QString::fromLatin1("/.kde-unit-test/share/config/qttestrc")); \
|
||||
QProcess dbus; \
|
||||
dbus.start("dbus-launch"); \
|
||||
dbus.waitForFinished(10000); \
|
||||
QByteArray session = dbus.readLine(); \
|
||||
if (session.isEmpty()) { \
|
||||
qFatal("Couldn't execute new dbus session"); \
|
||||
} \
|
||||
int pos = session.indexOf('='); \
|
||||
setenv(session.left(pos), session.right(session.count() - pos - 1).trimmed(), 1); \
|
||||
session = dbus.readLine(); \
|
||||
pos = session.indexOf('='); \
|
||||
QByteArray pid = session.right(session.count() - pos - 1).trimmed(); \
|
||||
KAboutData aboutData( QByteArray("qttest"), QByteArray(), ki18n("KDE Test Program"), QByteArray("version") ); \
|
||||
KComponentData cData(&aboutData); \
|
||||
QCoreApplication app( argc, argv ); \
|
||||
app.setApplicationName( QLatin1String("qttest") ); \
|
||||
qRegisterMetaType<KUrl>(); /*as done by kapplication*/ \
|
||||
qRegisterMetaType<KUrl::List>(); \
|
||||
TestObject tc; \
|
||||
KGlobal::ref(); /* don't quit qeventloop after closing a mainwindow */ \
|
||||
int result = QTest::qExec( &tc, argc, argv ); \
|
||||
dbus.start("kill", QStringList() << "-9" << pid); \
|
||||
dbus.waitForFinished(10000); \
|
||||
return result; \
|
||||
}
|
||||
#endif //KWALLET_CUSTOM_QTEST
|
|
@ -1,74 +0,0 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2013 by Alejandro Fiestas Olivares <afiestas@kde.org> *
|
||||
* *
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
||||
*************************************************************************************/
|
||||
|
||||
#include "kwalletexecuter.h"
|
||||
#include "qtest_kwallet.h"
|
||||
#include <backendpersisthandler.h>
|
||||
|
||||
#include <kstandarddirs.h>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/qfile.h>
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusServiceWatcher>
|
||||
|
||||
class testPamOpen : public KWalletExecuter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void testOpen();
|
||||
void testRead();
|
||||
void testWrite();
|
||||
};
|
||||
|
||||
void testPamOpen::initTestCase()
|
||||
{
|
||||
QString from(TEST_DATA);
|
||||
from.append("kdewallet.kwl");
|
||||
QString to = KStandardDirs::locateLocal("data", "kwallet/kdewallet.kwl");
|
||||
QFile::remove(to);
|
||||
QFile::copy(from, to);
|
||||
execute();
|
||||
}
|
||||
|
||||
void testPamOpen::testOpen()
|
||||
{
|
||||
pamOpen();
|
||||
}
|
||||
|
||||
void testPamOpen::testRead()
|
||||
{
|
||||
pamRead(QLatin1String("bar"));
|
||||
}
|
||||
|
||||
void testPamOpen::testWrite()
|
||||
{
|
||||
const QString value("bar2");
|
||||
pamWrite(value);
|
||||
pamRead(value);
|
||||
}
|
||||
|
||||
QTEST_KDEMAIN_CORE_WITH_DBUS_DAEMON(testPamOpen)
|
||||
|
||||
#include "testpamopen.moc"
|
|
@ -1,69 +0,0 @@
|
|||
/*************************************************************************************
|
||||
* Copyright (C) 2013 by Alejandro Fiestas Olivares <afiestas@kde.org> *
|
||||
* *
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
|
||||
*************************************************************************************/
|
||||
|
||||
#include "kwalletexecuter.h"
|
||||
|
||||
#include "qtest_kwallet.h"
|
||||
|
||||
#include <kstandarddirs.h>
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/qprocess.h>
|
||||
#include <QtCore/qfile.h>
|
||||
|
||||
class testPamOpenNoFile : public KWalletExecuter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void testOpen();
|
||||
void testRead();
|
||||
void testWrite();
|
||||
};
|
||||
|
||||
void testPamOpenNoFile::initTestCase()
|
||||
{
|
||||
//Make sure no file is there, so kwalletd should create one
|
||||
const QString to = KStandardDirs::locateLocal("data", "kwallet/kdewallet.kwl");
|
||||
qDebug() << "Removing: " << to;
|
||||
qDebug() << "RemoveDF: " << QFile::remove(to);
|
||||
execute();
|
||||
}
|
||||
|
||||
void testPamOpenNoFile::testOpen()
|
||||
{
|
||||
pamOpen();
|
||||
}
|
||||
|
||||
void testPamOpenNoFile::testRead()
|
||||
{
|
||||
pamRead(QString());
|
||||
}
|
||||
|
||||
void testPamOpenNoFile::testWrite()
|
||||
{
|
||||
const QLatin1String value("bar");
|
||||
pamWrite(value);
|
||||
pamRead(value);
|
||||
}
|
||||
|
||||
QTEST_KDEMAIN_CORE_WITH_DBUS_DAEMON(testPamOpenNoFile)
|
||||
|
||||
#include "testpamopennofile.moc"
|
|
@ -1,37 +0,0 @@
|
|||
########### Configure checks for kwalletbackend ###############
|
||||
|
||||
check_include_files(stdint.h HAVE_STDINT_H)
|
||||
check_include_files(sys/bitypes.h HAVE_SYS_BITYPES_H)
|
||||
|
||||
configure_file(
|
||||
config-kwalletbackend.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config-kwalletbackend.h
|
||||
)
|
||||
|
||||
########### kwalletbackend ###############
|
||||
|
||||
set(kwalletbackend_LIB_SRCS
|
||||
blockcipher.cc
|
||||
blowfish.cc
|
||||
cbc.cc
|
||||
kwalletentry.cc
|
||||
kwalletbackend.cc
|
||||
backendpersisthandler.cpp
|
||||
)
|
||||
|
||||
add_library(kwalletbackend SHARED ${kwalletbackend_LIB_SRCS})
|
||||
|
||||
target_link_libraries(kwalletbackend ${KDE4_KDEUI_LIBS})
|
||||
|
||||
set_target_properties(kwalletbackend PROPERTIES
|
||||
VERSION ${GENERIC_LIB_VERSION}
|
||||
SOVERSION ${GENERIC_LIB_SOVERSION}
|
||||
)
|
||||
|
||||
generate_export_header(kwalletbackend)
|
||||
|
||||
install(TARGETS kwalletbackend ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
if(ENABLE_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
|
@ -1,361 +0,0 @@
|
|||
/**
|
||||
* This file is part of the KDE project
|
||||
* Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <QIODevice>
|
||||
#include <QFile>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include <ksavefile.h>
|
||||
#include <kdebug.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <klocalizedstring.h>
|
||||
|
||||
#include "backendpersisthandler.h"
|
||||
#include "kwalletbackend.h"
|
||||
#include "blowfish.h"
|
||||
#include "cbc.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define KWALLET_CIPHER_BLOWFISH_ECB 0 // this was the old KWALLET_CIPHER_BLOWFISH_CBC
|
||||
#define KWALLET_CIPHER_3DES_CBC 1 // unsupported
|
||||
#define KWALLET_CIPHER_GPG 2 // unsupported
|
||||
#define KWALLET_CIPHER_BLOWFISH_CBC 3
|
||||
|
||||
#define KWALLET_HASH_SHA1 0 // fallback
|
||||
#define KWALLET_HASH_MD5 1 // unsupported
|
||||
#define KWALLET_HASH_PBKDF2_SHA512 2 // used since 4.13 version
|
||||
#define KWALLET_HASH_SHA512 3 // used since 4.20 version
|
||||
|
||||
namespace KWallet {
|
||||
|
||||
typedef char Digest[16];
|
||||
|
||||
static BlowfishPersistHandler *blowfishHandler = 0;
|
||||
|
||||
BackendPersistHandler *BackendPersistHandler::getPersistHandler(BackendCipherType cipherType)
|
||||
{
|
||||
switch (cipherType){
|
||||
case BACKEND_CIPHER_BLOWFISH: {
|
||||
if (blowfishHandler == 0) {
|
||||
blowfishHandler = new BlowfishPersistHandler;
|
||||
}
|
||||
return blowfishHandler;
|
||||
}
|
||||
default: {
|
||||
Q_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BackendPersistHandler *BackendPersistHandler::getPersistHandler(char magicBuf[KWMAGIC_LEN])
|
||||
{
|
||||
if (magicBuf[2] == KWALLET_CIPHER_BLOWFISH_CBC && magicBuf[3] == KWALLET_HASH_SHA512) {
|
||||
if (blowfishHandler == 0) {
|
||||
blowfishHandler = new BlowfishPersistHandler();
|
||||
}
|
||||
return blowfishHandler;
|
||||
}
|
||||
return 0; // unknown cipher or hash
|
||||
}
|
||||
|
||||
int BlowfishPersistHandler::write(Backend* wb, KSaveFile& sf, QByteArray& version, WId)
|
||||
{
|
||||
assert(wb->_cipherType == BACKEND_CIPHER_BLOWFISH);
|
||||
|
||||
version[2] = KWALLET_CIPHER_BLOWFISH_CBC;
|
||||
version[3] = KWALLET_HASH_SHA512; // Since 4.20 we always use SHA512
|
||||
|
||||
if (sf.write(version, 4) != 4) {
|
||||
sf.abort();
|
||||
return -4; // write error
|
||||
}
|
||||
|
||||
// Holds the hashes we write out
|
||||
QByteArray hashes;
|
||||
QDataStream hashStream(&hashes, QIODevice::WriteOnly);
|
||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||
hashStream << static_cast<quint32>(wb->_entries.count());
|
||||
|
||||
// Holds decrypted data prior to encryption
|
||||
QByteArray decrypted;
|
||||
|
||||
// FIXME: we should estimate the amount of data we will write in each
|
||||
// buffer and resize them approximately in order to avoid extra
|
||||
// resizes.
|
||||
|
||||
// populate decrypted
|
||||
QDataStream dStream(&decrypted, QIODevice::WriteOnly);
|
||||
for (Backend::FolderMap::ConstIterator i = wb->_entries.constBegin(); i != wb->_entries.constEnd(); ++i) {
|
||||
dStream << i.key();
|
||||
dStream << static_cast<quint32>(i.value().count());
|
||||
|
||||
md5.reset();
|
||||
md5.addData(i.key().toUtf8());
|
||||
hashStream.writeRawData(md5.result().constData(), 16);
|
||||
hashStream << static_cast<quint32>(i.value().count());
|
||||
|
||||
for (Backend::EntryMap::ConstIterator j = i.value().constBegin(); j != i.value().constEnd(); ++j) {
|
||||
dStream << j.key();
|
||||
dStream << static_cast<qint32>(j.value()->type());
|
||||
dStream << j.value()->value();
|
||||
|
||||
md5.reset();
|
||||
md5.addData(j.key().toUtf8());
|
||||
hashStream.writeRawData(md5.result().constData(), 16);
|
||||
}
|
||||
}
|
||||
|
||||
if (sf.write(hashes, hashes.size()) != hashes.size()) {
|
||||
sf.abort();
|
||||
return -4; // write error
|
||||
}
|
||||
|
||||
// calculate the hash of the file
|
||||
QCryptographicHash sha(QCryptographicHash::Sha1);
|
||||
BlowFish _bf;
|
||||
CipherBlockChain bf(&_bf);
|
||||
|
||||
sha.addData(decrypted);
|
||||
|
||||
// prepend and append the random data
|
||||
QByteArray wholeFile;
|
||||
long blksz = bf.blockSize();
|
||||
long newsize = decrypted.size() +
|
||||
blksz + // encrypted block
|
||||
4 + // file size
|
||||
20; // size of the SHA hash
|
||||
|
||||
int delta = (blksz - (newsize % blksz));
|
||||
newsize += delta;
|
||||
wholeFile.resize(newsize);
|
||||
|
||||
const int randBlockSize = blksz+delta;
|
||||
char randomData[randBlockSize];
|
||||
::memset(randomData, 0, randBlockSize * sizeof(char));
|
||||
for (int i = 0; i < randBlockSize; i++) {
|
||||
randomData[i] = char(qrand() % SHRT_MAX);
|
||||
}
|
||||
QByteArray randBlock(randomData, randBlockSize);
|
||||
|
||||
for (int i = 0; i < blksz; i++) {
|
||||
wholeFile[i] = randBlock[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
wholeFile[(int)(i+blksz)] = (decrypted.size() >> 8*(3-i))&0xff;
|
||||
}
|
||||
|
||||
for (int i = 0; i < decrypted.size(); i++) {
|
||||
wholeFile[(int)(i+blksz+4)] = decrypted[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < delta; i++) {
|
||||
wholeFile[(int)(i+blksz+4+decrypted.size())] = randBlock[(int)(i+blksz)];
|
||||
}
|
||||
|
||||
const QByteArray hash = sha.result();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
wholeFile[(int)(newsize - 20 + i)] = hash[i];
|
||||
}
|
||||
|
||||
sha.reset();
|
||||
decrypted.fill(0);
|
||||
|
||||
// encrypt the data
|
||||
if (!bf.setKey(wb->_passhash.data(), wb->_passhash.size() * 8)) {
|
||||
wholeFile.fill(0);
|
||||
sf.abort();
|
||||
return -2; // encrypt error
|
||||
}
|
||||
|
||||
int rc = bf.encrypt(wholeFile.data(), wholeFile.size());
|
||||
if (rc < 0) {
|
||||
wholeFile.fill(0);
|
||||
sf.abort();
|
||||
return -2; // encrypt error
|
||||
}
|
||||
|
||||
// write the file
|
||||
if (sf.write(wholeFile, wholeFile.size()) != wholeFile.size()) {
|
||||
wholeFile.fill(0);
|
||||
sf.abort();
|
||||
return -4; // write error
|
||||
}
|
||||
if (!sf.finalize()) {
|
||||
kDebug() << "WARNING: wallet sync to disk failed! KSaveFile status was " << sf.errorString();
|
||||
wholeFile.fill(0);
|
||||
return -4; // write error
|
||||
}
|
||||
|
||||
wholeFile.fill(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int BlowfishPersistHandler::read(Backend* wb, QFile& db, WId)
|
||||
{
|
||||
wb->_cipherType = BACKEND_CIPHER_BLOWFISH;
|
||||
wb->_hashes.clear();
|
||||
// Read in the hashes
|
||||
QDataStream hds(&db);
|
||||
quint32 n;
|
||||
hds >> n;
|
||||
if (n > 0xffff) { // sanity check
|
||||
return -43;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
Digest d, d2; // judgment day
|
||||
MD5Digest ba;
|
||||
QMap<MD5Digest,QList<MD5Digest> >::iterator it;
|
||||
quint32 fsz;
|
||||
if (hds.atEnd()) return -43;
|
||||
hds.readRawData(d, 16);
|
||||
hds >> fsz;
|
||||
ba = MD5Digest(reinterpret_cast<char *>(d));
|
||||
it = wb->_hashes.insert(ba, QList<MD5Digest>());
|
||||
for (size_t j = 0; j < fsz; ++j) {
|
||||
hds.readRawData(d2, 16);
|
||||
ba = MD5Digest(d2);
|
||||
(*it).append(ba);
|
||||
}
|
||||
}
|
||||
|
||||
// Read in the rest of the file.
|
||||
QByteArray encrypted = db.readAll();
|
||||
assert(encrypted.size() < db.size());
|
||||
|
||||
BlowFish _bf;
|
||||
CipherBlockChain bf(&_bf);
|
||||
int blksz = bf.blockSize();
|
||||
if ((encrypted.size() % blksz) != 0) {
|
||||
return -5; // invalid file structure
|
||||
}
|
||||
|
||||
bf.setKey((void *)wb->_passhash.data(), wb->_passhash.size()*8);
|
||||
|
||||
if (!encrypted.data()) {
|
||||
wb->_passhash.fill(0);
|
||||
encrypted.fill(0);
|
||||
return -7; // file structure error
|
||||
}
|
||||
|
||||
int rc = bf.decrypt(encrypted.data(), encrypted.size());
|
||||
if (rc < 0) {
|
||||
wb->_passhash.fill(0);
|
||||
encrypted.fill(0);
|
||||
return -6; // decrypt error
|
||||
}
|
||||
|
||||
const char *t = encrypted.data();
|
||||
|
||||
// strip the leading data
|
||||
t += blksz; // one block of random data
|
||||
|
||||
// strip the file size off
|
||||
long fsize = 0;
|
||||
|
||||
fsize |= (long(*t) << 24) & 0xff000000;
|
||||
t++;
|
||||
fsize |= (long(*t) << 16) & 0x00ff0000;
|
||||
t++;
|
||||
fsize |= (long(*t) << 8) & 0x0000ff00;
|
||||
t++;
|
||||
fsize |= long(*t) & 0x000000ff;
|
||||
t++;
|
||||
|
||||
if (fsize < 0 || fsize > long(encrypted.size()) - blksz - 4) {
|
||||
//kDebug() << "fsize: " << fsize << " encrypted.size(): " << encrypted.size() << " blksz: " << blksz;
|
||||
encrypted.fill(0);
|
||||
return -9; // file structure error.
|
||||
}
|
||||
|
||||
// compute the hash ourself
|
||||
QCryptographicHash sha(QCryptographicHash::Sha1);
|
||||
sha.addData(t, fsize);
|
||||
const QByteArray testhash = sha.result();
|
||||
|
||||
// compare hashes
|
||||
int sz = encrypted.size();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
if (testhash[i] != encrypted[sz - 20 + i]) {
|
||||
encrypted.fill(0);
|
||||
sha.reset();
|
||||
return -8; // hash error.
|
||||
}
|
||||
}
|
||||
|
||||
sha.reset();
|
||||
|
||||
// chop off the leading blksz+4 bytes
|
||||
QByteArray tmpenc(encrypted.data()+blksz+4, fsize);
|
||||
encrypted = tmpenc;
|
||||
tmpenc.fill(0);
|
||||
|
||||
// Load the data structures up
|
||||
QDataStream eStream(encrypted);
|
||||
|
||||
while (!eStream.atEnd()) {
|
||||
QString folder;
|
||||
quint32 n;
|
||||
|
||||
eStream >> folder;
|
||||
eStream >> n;
|
||||
|
||||
// Force initialisation
|
||||
wb->_entries[folder].clear();
|
||||
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
QString key;
|
||||
KWallet::Wallet::EntryType et = KWallet::Wallet::Unknown;
|
||||
Entry *e = new Entry;
|
||||
eStream >> key;
|
||||
qint32 x = 0; // necessary to read properly
|
||||
eStream >> x;
|
||||
et = static_cast<KWallet::Wallet::EntryType>(x);
|
||||
|
||||
switch (et) {
|
||||
case KWallet::Wallet::Password:
|
||||
case KWallet::Wallet::Stream:
|
||||
case KWallet::Wallet::Map:
|
||||
break;
|
||||
default: // Unknown entry
|
||||
delete e;
|
||||
continue;
|
||||
}
|
||||
|
||||
QByteArray a;
|
||||
eStream >> a;
|
||||
e->setValue(a);
|
||||
e->setType(et);
|
||||
e->setKey(key);
|
||||
wb->_entries[folder][key] = e;
|
||||
}
|
||||
}
|
||||
|
||||
wb->_open = true;
|
||||
encrypted.fill(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace
|
|
@ -1,68 +0,0 @@
|
|||
/**
|
||||
* This file is part of the KDE project
|
||||
* Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef BACKENDPERSISTHANDLER_H
|
||||
#define BACKENDPERSISTHANDLER_H
|
||||
|
||||
#define KWMAGIC_LEN 12
|
||||
|
||||
#include <qwindowdefs.h>
|
||||
#include <QFile>
|
||||
|
||||
class KSaveFile;
|
||||
namespace KWallet {
|
||||
|
||||
class Backend;
|
||||
|
||||
enum BackendCipherType {
|
||||
BACKEND_CIPHER_UNKNOWN, /// this is used by freshly allocated wallets
|
||||
BACKEND_CIPHER_BLOWFISH, /// use the legacy blowfish cipher type
|
||||
};
|
||||
|
||||
class BackendPersistHandler {
|
||||
protected:
|
||||
BackendPersistHandler() {}
|
||||
public:
|
||||
virtual ~BackendPersistHandler() {}
|
||||
/**
|
||||
* This is a factory method used to get an instance of the backend suitable
|
||||
* for reading/writing using the given cipher type
|
||||
*
|
||||
* @param cypherType indication of the backend that should be returned
|
||||
* @return a pointer to an instance of the requested handler type. No need to delete this pointer, it's lifetime is taken care of by this factory
|
||||
*/
|
||||
static BackendPersistHandler *getPersistHandler(BackendCipherType cipherType);
|
||||
static BackendPersistHandler *getPersistHandler(char magicBuf[KWMAGIC_LEN]);
|
||||
|
||||
virtual int write(Backend* wb, KSaveFile& sf, QByteArray& version, WId w) =0;
|
||||
virtual int read(Backend* wb, QFile& sf, WId w) =0;
|
||||
};
|
||||
|
||||
|
||||
class BlowfishPersistHandler : public BackendPersistHandler {
|
||||
public:
|
||||
explicit BlowfishPersistHandler() {}
|
||||
virtual ~BlowfishPersistHandler() {}
|
||||
|
||||
virtual int write(Backend* wb, KSaveFile& sf, QByteArray& version, WId w);
|
||||
virtual int read(Backend* wb, QFile& sf, WId w);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // BACKENDPERSISTHANDLER_H
|
|
@ -1,37 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "blockcipher.h"
|
||||
|
||||
|
||||
|
||||
BlockCipher::BlockCipher() {
|
||||
_blksz = -1;
|
||||
}
|
||||
|
||||
|
||||
BlockCipher::~BlockCipher() {
|
||||
}
|
||||
|
||||
|
||||
int BlockCipher::blockSize() const {
|
||||
return _blksz;
|
||||
}
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef BLOCKCIPHER_H
|
||||
#define BLOCKCIPHER_H
|
||||
|
||||
/* @internal
|
||||
*/
|
||||
class BlockCipher {
|
||||
public:
|
||||
BlockCipher();
|
||||
virtual ~BlockCipher();
|
||||
|
||||
/*
|
||||
* Return the current blocksize in bytes.
|
||||
*/
|
||||
int blockSize() const;
|
||||
|
||||
/*
|
||||
* Set the encryption key to key. Return true on success.
|
||||
*/
|
||||
virtual bool setKey(void *key, int bitlength) = 0;
|
||||
|
||||
/*
|
||||
* Get the required (or if it's variable, then the maximum) key
|
||||
* length for this cipher in bits.
|
||||
*/
|
||||
virtual int keyLen() const = 0;
|
||||
|
||||
/*
|
||||
* True if all settings are good and we are ready to encrypt.
|
||||
*/
|
||||
virtual bool readyToGo() const = 0;
|
||||
|
||||
/*
|
||||
* Encrypt the block. Returns the number of bytes successfully
|
||||
* encrypted. Can return -1 on error.
|
||||
*/
|
||||
virtual int encrypt(void *block, int len) = 0;
|
||||
|
||||
/*
|
||||
* Decrypt the block. Returns as does encrypt();
|
||||
*/
|
||||
virtual int decrypt(void *block, int len) = 0;
|
||||
|
||||
protected:
|
||||
int _blksz;
|
||||
int _keylen; // in bits
|
||||
};
|
||||
|
||||
#endif // BLOCKCIPHER_H
|
|
@ -1,253 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
// FIXME: should we unroll some loops? Optimization can be done here.
|
||||
|
||||
|
||||
/* Implementation of 16 rounds blowfish as described in:
|
||||
* _Applied_Cryptography_ (c) Bruce Schneier, 1996.
|
||||
*/
|
||||
|
||||
#include "blowfish.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "blowfishtables.h"
|
||||
|
||||
|
||||
BlowFish::BlowFish() {
|
||||
_blksz = 8;
|
||||
_key = 0L;
|
||||
_init = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool BlowFish::init() {
|
||||
// Initialize the sboxes
|
||||
for (int i = 0; i < 256; i++) {
|
||||
_BF_S[0][i] = ks0[i];
|
||||
_BF_S[1][i] = ks1[i];
|
||||
_BF_S[2][i] = ks2[i];
|
||||
_BF_S[3][i] = ks3[i];
|
||||
}
|
||||
|
||||
uint32_t datal = 0;
|
||||
uint32_t datar = 0;
|
||||
uint32_t data = 0;
|
||||
int j = 0;
|
||||
|
||||
|
||||
// Update the sboxes and pbox.
|
||||
for (int i = 0; i < 18; i++) {
|
||||
data = 0;
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
data = (data << 8) | ((unsigned char *)_key)[j++];
|
||||
if (j >= _keylen / 8) {
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
_BF_P[i] = P[i] ^ data;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 18; i += 2) {
|
||||
encipher(&datal, &datar);
|
||||
_BF_P[i] = datal;
|
||||
_BF_P[i+1] = datar;
|
||||
}
|
||||
|
||||
for (int j = 0; j < 4; j++) {
|
||||
for (int i = 0; i < 256; i += 2) {
|
||||
encipher(&datal, &datar);
|
||||
_BF_S[j][i] = datal;
|
||||
_BF_S[j][i+1] = datar;
|
||||
}
|
||||
}
|
||||
|
||||
// Nice code from gpg's implementation...
|
||||
// check to see if the key is weak and return error if so
|
||||
for (int i = 0; i < 255; i++) {
|
||||
for (int j = i + 1; j < 256; j++) {
|
||||
if ((_BF_S[0][i] == _BF_S[0][j]) || (_BF_S[1][i] == _BF_S[1][j]) ||
|
||||
(_BF_S[2][i] == _BF_S[2][j]) || (_BF_S[3][i] == _BF_S[3][j])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_init = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BlowFish::~BlowFish() {
|
||||
delete[] (unsigned char *)_key;
|
||||
_key = 0L;
|
||||
}
|
||||
|
||||
|
||||
int BlowFish::keyLen() const {
|
||||
return 512;
|
||||
}
|
||||
|
||||
|
||||
bool BlowFish::readyToGo() const {
|
||||
return _init;
|
||||
}
|
||||
|
||||
|
||||
bool BlowFish::setKey(void *key, int bitlength) {
|
||||
if (bitlength <= 0 || bitlength > 512 || bitlength % 8 != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
delete[] (unsigned char *)_key;
|
||||
|
||||
_key = new unsigned char[bitlength / 8];
|
||||
memcpy(_key, key, bitlength / 8);
|
||||
_keylen = bitlength;
|
||||
|
||||
return init();
|
||||
}
|
||||
|
||||
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
#define shuffle(x) do { \
|
||||
uint32_t r = x; \
|
||||
x = (r & 0xff000000) >> 24; \
|
||||
x |= (r & 0x00ff0000) >> 8; \
|
||||
x |= (r & 0x0000ff00) << 8; \
|
||||
x |= (r & 0x000000ff) << 24; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
int BlowFish::encrypt(void *block, int len) {
|
||||
uint32_t *d = (uint32_t *)block;
|
||||
|
||||
if (!_init || len % _blksz != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < len / _blksz; i++) {
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
shuffle(*d);
|
||||
shuffle(*(d + 1));
|
||||
#endif
|
||||
encipher(d, d + 1);
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
shuffle(*d);
|
||||
shuffle(*(d + 1));
|
||||
#endif
|
||||
d += 2;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
int BlowFish::decrypt(void *block, int len) {
|
||||
uint32_t *d = (uint32_t *)block;
|
||||
|
||||
if (!_init || len % _blksz != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < len / _blksz; i++) {
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
shuffle(*d);
|
||||
shuffle(*(d + 1));
|
||||
#endif
|
||||
decipher(d, d + 1);
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
shuffle(*d);
|
||||
shuffle(*(d + 1));
|
||||
#endif
|
||||
d += 2;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
uint32_t BlowFish::F(uint32_t x) {
|
||||
unsigned short a, b, c, d;
|
||||
uint32_t y;
|
||||
|
||||
d = x & 0x000000ff;
|
||||
x >>= 8;
|
||||
c = x & 0x000000ff;
|
||||
x >>= 8;
|
||||
b = x & 0x000000ff;
|
||||
x >>= 8;
|
||||
a = x & 0x000000ff;
|
||||
|
||||
y = _BF_S[0][a] + _BF_S[1][b];
|
||||
y ^= _BF_S[2][c];
|
||||
y += _BF_S[3][d];
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
void BlowFish::encipher(uint32_t *xl, uint32_t *xr) {
|
||||
uint32_t Xl = *xl, Xr = *xr, temp;
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
Xl ^= _BF_P[i];
|
||||
Xr ^= F(Xl);
|
||||
// Exchange
|
||||
temp = Xl; Xl = Xr; Xr = temp;
|
||||
}
|
||||
|
||||
// Exchange
|
||||
temp = Xl; Xl = Xr; Xr = temp;
|
||||
|
||||
Xr ^= _BF_P[16];
|
||||
Xl ^= _BF_P[17];
|
||||
|
||||
*xl = Xl;
|
||||
*xr = Xr;
|
||||
}
|
||||
|
||||
|
||||
void BlowFish::decipher(uint32_t *xl, uint32_t *xr) {
|
||||
uint32_t Xl = *xl, Xr = *xr, temp;
|
||||
|
||||
for (int i = 17; i > 1; --i) {
|
||||
Xl ^= _BF_P[i];
|
||||
Xr ^= F(Xl);
|
||||
// Exchange
|
||||
temp = Xl; Xl = Xr; Xr = temp;
|
||||
}
|
||||
|
||||
// Exchange
|
||||
temp = Xl; Xl = Xr; Xr = temp;
|
||||
|
||||
Xr ^= _BF_P[1];
|
||||
Xl ^= _BF_P[0];
|
||||
|
||||
*xl = Xl;
|
||||
*xr = Xr;
|
||||
}
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef BLOWFISH_H
|
||||
#define BLOWFISH_H
|
||||
|
||||
#include <config-kwalletbackend.h>
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_BITYPES_H
|
||||
#include <sys/bitypes.h> /* For uintXX_t on Tru64 */
|
||||
#endif
|
||||
|
||||
#include "blockcipher.h"
|
||||
#include "kwalletbackend_export.h"
|
||||
|
||||
/* @internal
|
||||
*/
|
||||
class KWALLETBACKEND_EXPORT BlowFish : public BlockCipher {
|
||||
public:
|
||||
BlowFish();
|
||||
virtual ~BlowFish();
|
||||
|
||||
virtual bool setKey(void *key, int bitlength);
|
||||
|
||||
virtual int keyLen() const;
|
||||
|
||||
virtual bool readyToGo() const;
|
||||
|
||||
virtual int encrypt(void *block, int len);
|
||||
|
||||
virtual int decrypt(void *block, int len);
|
||||
|
||||
private:
|
||||
uint32_t _BF_S[4][256];
|
||||
uint32_t _BF_P[18];
|
||||
|
||||
void *_key;
|
||||
int _keylen; // in bits
|
||||
|
||||
bool _init;
|
||||
|
||||
bool init();
|
||||
uint32_t F(uint32_t x);
|
||||
void encipher(uint32_t *xl, uint32_t *xr);
|
||||
void decipher(uint32_t *xl, uint32_t *xr);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,210 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// This is also from _Applied_Cryptography_. See blowfish.cc for more details.
|
||||
|
||||
#ifndef BLOWFISHTABLES_H
|
||||
#define BLOWFISHTABLES_H
|
||||
|
||||
const unsigned long ks0[256] = {
|
||||
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96,
|
||||
0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
|
||||
0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658,
|
||||
0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
|
||||
0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e,
|
||||
0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
|
||||
0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6,
|
||||
0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
|
||||
0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c,
|
||||
0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
|
||||
0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1,
|
||||
0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
|
||||
0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a,
|
||||
0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
|
||||
0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176,
|
||||
0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
|
||||
0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706,
|
||||
0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
|
||||
0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b,
|
||||
0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
|
||||
0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c,
|
||||
0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
|
||||
0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a,
|
||||
0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
|
||||
0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760,
|
||||
0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
|
||||
0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8,
|
||||
0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
|
||||
0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33,
|
||||
0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
|
||||
0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0,
|
||||
0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
|
||||
0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777,
|
||||
0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
|
||||
0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705,
|
||||
0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
|
||||
0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x00250e2d, 0x2071b35e,
|
||||
0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
|
||||
0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5, 0x83260376, 0x6295cfa9,
|
||||
0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
|
||||
0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f,
|
||||
0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
|
||||
0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a };
|
||||
|
||||
const unsigned long ks1[256] = {
|
||||
0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d,
|
||||
0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
|
||||
0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65,
|
||||
0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
|
||||
0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9,
|
||||
0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
|
||||
0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d,
|
||||
0xf01c1f04, 0x0200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
|
||||
0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc,
|
||||
0xc8b57634, 0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
|
||||
0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908,
|
||||
0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
|
||||
0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124,
|
||||
0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
|
||||
0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908,
|
||||
0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
|
||||
0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x043556f1, 0xd7a3c76b,
|
||||
0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
|
||||
0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa,
|
||||
0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
|
||||
0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d,
|
||||
0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
|
||||
0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5,
|
||||
0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
|
||||
0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96,
|
||||
0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
|
||||
0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca,
|
||||
0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
|
||||
0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77,
|
||||
0x11ed935f, 0x16681281, 0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
|
||||
0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054,
|
||||
0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
|
||||
0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea,
|
||||
0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
|
||||
0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646,
|
||||
0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
|
||||
0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0x0c55f5ea,
|
||||
0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
|
||||
0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e,
|
||||
0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
|
||||
0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd,
|
||||
0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
|
||||
0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7 };
|
||||
|
||||
const unsigned long ks2[256] = {
|
||||
0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7,
|
||||
0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
|
||||
0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af,
|
||||
0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
|
||||
0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4,
|
||||
0x0a2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
|
||||
0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec,
|
||||
0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
|
||||
0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332,
|
||||
0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
|
||||
0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58,
|
||||
0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
|
||||
0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, 0xe4c66d22,
|
||||
0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
|
||||
0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60,
|
||||
0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
|
||||
0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99,
|
||||
0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
|
||||
0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74,
|
||||
0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
|
||||
0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3,
|
||||
0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
|
||||
0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979,
|
||||
0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
|
||||
0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa,
|
||||
0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
|
||||
0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086,
|
||||
0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
|
||||
0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24,
|
||||
0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
|
||||
0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84,
|
||||
0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
|
||||
0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09,
|
||||
0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
|
||||
0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe,
|
||||
0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
|
||||
0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0,
|
||||
0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
|
||||
0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188,
|
||||
0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
|
||||
0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8,
|
||||
0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
|
||||
0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0 };
|
||||
|
||||
const unsigned long ks3[256] = {
|
||||
0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742,
|
||||
0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
|
||||
0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79,
|
||||
0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
|
||||
0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a,
|
||||
0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
|
||||
0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1,
|
||||
0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
|
||||
0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797,
|
||||
0x2cf0b7d9, 0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
|
||||
0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6,
|
||||
0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
|
||||
0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba,
|
||||
0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
|
||||
0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5,
|
||||
0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
|
||||
0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce,
|
||||
0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
|
||||
0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd,
|
||||
0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
|
||||
0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb,
|
||||
0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
|
||||
0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc,
|
||||
0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
|
||||
0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc,
|
||||
0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
|
||||
0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a,
|
||||
0xd0dadecb, 0xd50ada38, 0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
|
||||
0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a,
|
||||
0x0f91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
|
||||
0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b,
|
||||
0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
|
||||
0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e,
|
||||
0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
|
||||
0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623,
|
||||
0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
|
||||
0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a,
|
||||
0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
|
||||
0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3,
|
||||
0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
|
||||
0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c,
|
||||
0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
|
||||
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6 };
|
||||
|
||||
const unsigned long P[18] = {
|
||||
0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0,
|
||||
0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
|
||||
0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b };
|
||||
|
||||
#endif // BLOWFISHTABLES_H
|
|
@ -1,157 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "cbc.h"
|
||||
#include <string.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
CipherBlockChain::CipherBlockChain(BlockCipher *cipher)
|
||||
: _cipher(cipher)
|
||||
{
|
||||
_next = 0L;
|
||||
_register = 0L;
|
||||
_len = -1;
|
||||
_reader = _writer = 0L;
|
||||
if (cipher) {
|
||||
_blksz = cipher->blockSize();
|
||||
}
|
||||
}
|
||||
|
||||
CipherBlockChain::~CipherBlockChain()
|
||||
{
|
||||
delete[](char *)_register;
|
||||
_register = 0L;
|
||||
delete[](char *)_next;
|
||||
_next = 0L;
|
||||
}
|
||||
|
||||
bool CipherBlockChain::setKey(void *key, int bitlength)
|
||||
{
|
||||
if (_cipher) {
|
||||
return _cipher->setKey(key, bitlength);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int CipherBlockChain::keyLen() const
|
||||
{
|
||||
if (_cipher) {
|
||||
return _cipher->keyLen();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CipherBlockChain::readyToGo() const
|
||||
{
|
||||
if (_cipher) {
|
||||
return _cipher->readyToGo();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CipherBlockChain::initRegister() {
|
||||
if (_register == 0L) {
|
||||
size_t registerLen = _cipher->blockSize();
|
||||
_register = new unsigned char[registerLen];
|
||||
_len = registerLen;
|
||||
}
|
||||
memset(_register, 0, _len);
|
||||
}
|
||||
|
||||
int CipherBlockChain::encrypt(void *block, int len)
|
||||
{
|
||||
int rc = -1;
|
||||
if (_cipher && !_reader) {
|
||||
|
||||
_writer |= 1;
|
||||
|
||||
initRegister();
|
||||
|
||||
if ((len % _len) >0) {
|
||||
kDebug() << "Block length given encrypt (" << len << ") is not a multiple of " << _len;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *elemBlock = static_cast<char*>(block);
|
||||
for (int b = 0; b < len/_len; b++) {
|
||||
|
||||
// This might be optimizable
|
||||
char *tb = static_cast<char*>(elemBlock);
|
||||
for (int i = 0; i < _len; i++) {
|
||||
*tb++ ^= ((char *)_register)[i];
|
||||
}
|
||||
|
||||
rc = _cipher->encrypt(elemBlock, _len);
|
||||
|
||||
if (rc != -1) {
|
||||
memcpy(_register, elemBlock, _len);
|
||||
}
|
||||
elemBlock += _len;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int CipherBlockChain::decrypt(void *block, int len)
|
||||
{
|
||||
if (_cipher && !_writer) {
|
||||
int rc = 0;
|
||||
|
||||
_reader |= 1;
|
||||
|
||||
initRegister();
|
||||
|
||||
if ((len % _len) >0) {
|
||||
kDebug() << "Block length given for decrypt (" << len << ") is not a multiple of " << _len;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *elemBlock = static_cast<char*>(block);
|
||||
for (int b = 0; b < len/_len; b++) {
|
||||
if (_next == 0L) {
|
||||
_next = new unsigned char[_len];
|
||||
}
|
||||
memcpy(_next, elemBlock, _len);
|
||||
|
||||
int bytesDecrypted = _cipher->decrypt(elemBlock, _len);
|
||||
|
||||
if (bytesDecrypted != -1) {
|
||||
rc += bytesDecrypted;
|
||||
// This might be optimizable
|
||||
char *tb = (char *)elemBlock;
|
||||
for (int i = 0; i < _len; i++) {
|
||||
*tb++ ^= ((char *)_register)[i];
|
||||
}
|
||||
}
|
||||
|
||||
void *temp;
|
||||
temp = _next;
|
||||
_next = _register;
|
||||
_register = temp;
|
||||
|
||||
elemBlock += _len;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef CBC__KO__H
|
||||
#define CBC__KO__H
|
||||
|
||||
#include "blockcipher.h"
|
||||
|
||||
/* @internal
|
||||
* Initialize this class with a pointer to a valid, uninitialized BlockCipher
|
||||
* and it will apply that cipher using CBC. You may want to make the
|
||||
* initial block a full block of random data. Do not change the block size
|
||||
* at any time!! You must pad it yourself. Also, you can only encrypt or
|
||||
* decrypt. You can't do both with a given instance. After you call one,
|
||||
* calls to the other will fail in this instance.
|
||||
*/
|
||||
|
||||
class CipherBlockChain : public BlockCipher
|
||||
{
|
||||
public:
|
||||
CipherBlockChain(BlockCipher *cipher);
|
||||
virtual ~CipherBlockChain();
|
||||
|
||||
virtual bool setKey(void *key, int bitlength);
|
||||
|
||||
virtual int keyLen() const;
|
||||
|
||||
virtual bool readyToGo() const;
|
||||
|
||||
virtual int encrypt(void *block, int len);
|
||||
|
||||
virtual int decrypt(void *block, int len);
|
||||
|
||||
private:
|
||||
void initRegister();
|
||||
|
||||
BlockCipher *_cipher;
|
||||
void *_register;
|
||||
void *_next;
|
||||
int _len;
|
||||
int _reader, _writer;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,3 +0,0 @@
|
|||
#cmakedefine HAVE_STDINT_H 1
|
||||
|
||||
#cmakedefine HAVE_SYS_BITYPES_H 1
|
|
@ -1,469 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
*
|
||||
* Copyright (C) 2001-2004 George Staikos <staikos@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "kwalletbackend.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <ksavefile.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <knotification.h>
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include "blowfish.h"
|
||||
#include "cbc.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define KWALLET_VERSION_MAJOR 0
|
||||
// has been 0 until 4.13, 1 until 4.20
|
||||
#define KWALLET_VERSION_MINOR 2
|
||||
|
||||
using namespace KWallet;
|
||||
|
||||
#define KWMAGIC "KWALLET\n\r\0\r\n"
|
||||
|
||||
class Backend::BackendPrivate
|
||||
{
|
||||
};
|
||||
|
||||
static void initKWalletDir()
|
||||
{
|
||||
KGlobal::dirs()->addResourceType("kwallet", 0, "share/apps/kwallet");
|
||||
}
|
||||
|
||||
Backend::Backend(const QString& name, bool isPath)
|
||||
: d(0)
|
||||
, _name(name)
|
||||
, _ref(0)
|
||||
, _cipherType(KWallet::BACKEND_CIPHER_UNKNOWN)
|
||||
{
|
||||
initKWalletDir();
|
||||
if (isPath) {
|
||||
_path = name;
|
||||
} else {
|
||||
_path = KGlobal::dirs()->saveLocation("kwallet") + _name + ".kwl";
|
||||
}
|
||||
|
||||
_open = false;
|
||||
}
|
||||
|
||||
|
||||
Backend::~Backend() {
|
||||
if (_open) {
|
||||
close();
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Backend::setCipherType(BackendCipherType ct)
|
||||
{
|
||||
// changing cipher type on already initialed wallets is not permitted
|
||||
assert(_cipherType == KWallet::BACKEND_CIPHER_UNKNOWN);
|
||||
_cipherType = ct;
|
||||
}
|
||||
|
||||
int Backend::deref() {
|
||||
if (--_ref < 0) {
|
||||
kDebug() << "refCount negative!";
|
||||
_ref = 0;
|
||||
}
|
||||
return _ref;
|
||||
}
|
||||
|
||||
bool Backend::exists(const QString& wallet) {
|
||||
initKWalletDir();
|
||||
QString path = KGlobal::dirs()->saveLocation("kwallet") + '/' + wallet + ".kwl";
|
||||
// Note: 60 bytes is presently the minimum size of a wallet file.
|
||||
// Anything smaller is junk.
|
||||
return QFile::exists(path) && QFileInfo(path).size() >= 60;
|
||||
}
|
||||
|
||||
|
||||
QString Backend::openRCToString(int rc) {
|
||||
switch (rc) {
|
||||
case -255:
|
||||
return i18n("Already open.");
|
||||
case -2:
|
||||
return i18n("Error opening file.");
|
||||
case -3:
|
||||
return i18n("Not a wallet file.");
|
||||
case -4:
|
||||
return i18n("Unsupported file format revision.");
|
||||
case -42:
|
||||
return i18n("Unknown encryption scheme.");
|
||||
case -43:
|
||||
return i18n("Corrupt file?");
|
||||
case -8:
|
||||
return i18n("Error validating wallet integrity. Possibly corrupted.");
|
||||
case -5:
|
||||
case -7:
|
||||
case -9:
|
||||
return i18n("Read error - possibly incorrect password.");
|
||||
case -6:
|
||||
return i18n("Decryption error.");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Backend::open(const QByteArray& password, WId w) {
|
||||
if (_open) {
|
||||
return -255; // already open
|
||||
}
|
||||
|
||||
setPassword(password);
|
||||
return openInternal(w);
|
||||
}
|
||||
|
||||
int Backend::openPreHashed(const QByteArray &passwordHash)
|
||||
{
|
||||
if (_open) {
|
||||
return -255; // already open
|
||||
}
|
||||
|
||||
// check the password hash for correct size (currently fixed)
|
||||
if (passwordHash.size() != KWALLET_SHA512_KEYSIZE) {
|
||||
return -42; // unsupported encryption scheme
|
||||
}
|
||||
|
||||
_passhash = passwordHash;
|
||||
|
||||
return openInternal();
|
||||
}
|
||||
|
||||
int Backend::openInternal(WId w)
|
||||
{
|
||||
// No wallet existed. Let's create it.
|
||||
// Note: 60 bytes is presently the minimum size of a wallet file.
|
||||
// Anything smaller is junk and should be deleted.
|
||||
if (!QFile::exists(_path) || QFileInfo(_path).size() < 60) {
|
||||
QFile newfile(_path);
|
||||
if (!newfile.open(QIODevice::ReadWrite)) {
|
||||
return -2; // error opening file
|
||||
}
|
||||
newfile.close();
|
||||
_open = true;
|
||||
if (sync(w) != 0) {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
QFile db(_path);
|
||||
|
||||
if (!db.open(QIODevice::ReadOnly)) {
|
||||
return -2; // error opening file
|
||||
}
|
||||
|
||||
char magicBuf[KWMAGIC_LEN];
|
||||
db.read(magicBuf, KWMAGIC_LEN);
|
||||
if (memcmp(magicBuf, KWMAGIC, KWMAGIC_LEN) != 0) {
|
||||
return -3; // bad magic
|
||||
}
|
||||
|
||||
db.read(magicBuf, 4);
|
||||
|
||||
// First byte is major version, second byte is minor version
|
||||
if (magicBuf[0] != KWALLET_VERSION_MAJOR) {
|
||||
return -4; // unknown version
|
||||
}
|
||||
|
||||
if (magicBuf[1] == KWALLET_VERSION_MINOR) {
|
||||
kDebug() << "Wallet new enough, using new hash";
|
||||
} else if (magicBuf[1] != 0){
|
||||
kDebug() << "Wallet is old, sad panda :(";
|
||||
return -4; // unknown version
|
||||
}
|
||||
|
||||
BackendPersistHandler *phandler = BackendPersistHandler::getPersistHandler(magicBuf);
|
||||
if (0 == phandler){
|
||||
return 42; // unknown cipher or hash
|
||||
}
|
||||
return phandler->read(this, db, w);
|
||||
}
|
||||
|
||||
int Backend::sync(WId w) {
|
||||
if (!_open) {
|
||||
return -255; // not open yet
|
||||
}
|
||||
|
||||
KSaveFile sf(_path);
|
||||
|
||||
if (!sf.open(QIODevice::WriteOnly | QIODevice::Unbuffered)) {
|
||||
return -1; // error opening file
|
||||
}
|
||||
sf.setPermissions(QFile::ReadUser|QFile::WriteUser);
|
||||
|
||||
if (sf.write(KWMAGIC, KWMAGIC_LEN) != KWMAGIC_LEN) {
|
||||
sf.abort();
|
||||
return -4; // write error
|
||||
}
|
||||
|
||||
// Write the version number
|
||||
QByteArray version(4, 0);
|
||||
version[0] = KWALLET_VERSION_MAJOR;
|
||||
version[1] = KWALLET_VERSION_MINOR;
|
||||
|
||||
BackendPersistHandler *phandler = BackendPersistHandler::getPersistHandler(_cipherType);
|
||||
if (0 == phandler) {
|
||||
return -4; // write error
|
||||
}
|
||||
int rc = phandler->write(this, sf, version, w);
|
||||
if (rc<0) {
|
||||
// Oops! wallet file sync filed! Display a notification about that
|
||||
// TODO: change kwalletd status flags, when status flags will be implemented
|
||||
KNotification *notification = new KNotification( "syncFailed" );
|
||||
notification->setText( i18n("Failed to sync wallet <b>%1</b> to disk. Error codes are:\nRC <b>%2</b>\nSF <b>%3</b>. Please file a BUG report using this information to bugs.kde.org").arg(_name).arg(rc).arg(sf.errorString()) );
|
||||
notification->sendEvent();
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int Backend::close(bool save) {
|
||||
// save if requested
|
||||
if (save) {
|
||||
int rc = sync(0);
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
// do the actual close
|
||||
for (FolderMap::ConstIterator i = _entries.constBegin(); i != _entries.constEnd(); ++i) {
|
||||
for (EntryMap::ConstIterator j = i.value().constBegin(); j != i.value().constEnd(); ++j) {
|
||||
delete j.value();
|
||||
}
|
||||
}
|
||||
_entries.clear();
|
||||
|
||||
// empty the password hash
|
||||
_passhash.fill(0);
|
||||
|
||||
_open = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const QString& Backend::walletName() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
bool Backend::isOpen() const {
|
||||
return _open;
|
||||
}
|
||||
|
||||
|
||||
QStringList Backend::folderList() const {
|
||||
return _entries.keys();
|
||||
}
|
||||
|
||||
|
||||
QStringList Backend::entryList() const {
|
||||
return _entries[_folder].keys();
|
||||
}
|
||||
|
||||
|
||||
Entry *Backend::readEntry(const QString& key) {
|
||||
Entry *rc = 0L;
|
||||
|
||||
if (_open && hasEntry(key)) {
|
||||
rc = _entries[_folder][key];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
QList<Entry*> Backend::readEntryList(const QString& key) {
|
||||
QList<Entry*> rc;
|
||||
|
||||
if (!_open) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
QRegExp re(key, Qt::CaseSensitive, QRegExp::Wildcard);
|
||||
|
||||
const EntryMap& map = _entries[_folder];
|
||||
for (EntryMap::ConstIterator i = map.begin(); i != map.end(); ++i) {
|
||||
if (re.exactMatch(i.key())) {
|
||||
rc.append(i.value());
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
bool Backend::createFolder(const QString& f) {
|
||||
if (_entries.contains(f)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_entries.insert(f, EntryMap());
|
||||
|
||||
QCryptographicHash folderMd5(QCryptographicHash::Md5);
|
||||
folderMd5.addData(f.toUtf8());
|
||||
_hashes.insert(MD5Digest(folderMd5.result()), QList<MD5Digest>());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int Backend::renameEntry(const QString& oldName, const QString& newName) {
|
||||
EntryMap& emap = _entries[_folder];
|
||||
EntryMap::Iterator oi = emap.find(oldName);
|
||||
EntryMap::Iterator ni = emap.find(newName);
|
||||
|
||||
if (oi != emap.end() && ni == emap.end()) {
|
||||
Entry *e = oi.value();
|
||||
emap.erase(oi);
|
||||
emap[newName] = e;
|
||||
|
||||
QCryptographicHash folderMd5(QCryptographicHash::Md5);
|
||||
folderMd5.addData(_folder.toUtf8());
|
||||
|
||||
HashMap::iterator i = _hashes.find(MD5Digest(folderMd5.result()));
|
||||
if (i != _hashes.end()) {
|
||||
QCryptographicHash oldMd5(QCryptographicHash::Md5), newMd5(QCryptographicHash::Md5);
|
||||
oldMd5.addData(oldName.toUtf8());
|
||||
newMd5.addData(newName.toUtf8());
|
||||
i.value().removeAll(MD5Digest(oldMd5.result()));
|
||||
i.value().append(MD5Digest(newMd5.result()));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void Backend::writeEntry(Entry *e) {
|
||||
if (!_open) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasEntry(e->key())) {
|
||||
_entries[_folder][e->key()] = new Entry;
|
||||
}
|
||||
_entries[_folder][e->key()]->copy(e);
|
||||
|
||||
QCryptographicHash folderMd5(QCryptographicHash::Md5);
|
||||
folderMd5.addData(_folder.toUtf8());
|
||||
|
||||
HashMap::iterator i = _hashes.find(MD5Digest(folderMd5.result()));
|
||||
if (i != _hashes.end()) {
|
||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||
md5.addData(e->key().toUtf8());
|
||||
i.value().append(MD5Digest(md5.result()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Backend::hasEntry(const QString& key) const {
|
||||
return _entries.contains(_folder) && _entries[_folder].contains(key);
|
||||
}
|
||||
|
||||
|
||||
bool Backend::removeEntry(const QString& key) {
|
||||
if (!_open) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FolderMap::Iterator fi = _entries.find(_folder);
|
||||
EntryMap::Iterator ei = fi.value().find(key);
|
||||
|
||||
if (fi != _entries.end() && ei != fi.value().end()) {
|
||||
delete ei.value();
|
||||
fi.value().erase(ei);
|
||||
QCryptographicHash folderMd5(QCryptographicHash::Md5);
|
||||
folderMd5.addData(_folder.toUtf8());
|
||||
|
||||
HashMap::iterator i = _hashes.find(MD5Digest(folderMd5.result()));
|
||||
if (i != _hashes.end()) {
|
||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||
md5.addData(key.toUtf8());
|
||||
i.value().removeAll(MD5Digest(md5.result()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Backend::removeFolder(const QString& f) {
|
||||
if (!_open) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FolderMap::Iterator fi = _entries.find(f);
|
||||
|
||||
if (fi != _entries.end()) {
|
||||
if (_folder == f) {
|
||||
_folder.clear();
|
||||
}
|
||||
|
||||
for (EntryMap::Iterator ei = fi.value().begin(); ei != fi.value().end(); ++ei) {
|
||||
delete ei.value();
|
||||
}
|
||||
|
||||
_entries.erase(fi);
|
||||
|
||||
QCryptographicHash folderMd5(QCryptographicHash::Md5);
|
||||
folderMd5.addData(f.toUtf8());
|
||||
_hashes.remove(MD5Digest(folderMd5.result()));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Backend::folderDoesNotExist(const QString& folder) const {
|
||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||
md5.addData(folder.toUtf8());
|
||||
return !_hashes.contains(MD5Digest(md5.result()));
|
||||
}
|
||||
|
||||
|
||||
bool Backend::entryDoesNotExist(const QString& folder, const QString& entry) const {
|
||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||
md5.addData(folder.toUtf8());
|
||||
HashMap::const_iterator i = _hashes.find(MD5Digest(md5.result()));
|
||||
if (i != _hashes.end()) {
|
||||
md5.reset();
|
||||
md5.addData(entry.toUtf8());
|
||||
return !i.value().contains(MD5Digest(md5.result()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Backend::setPassword(const QByteArray &password) {
|
||||
_passhash = QCryptographicHash::hash(password, QCryptographicHash::Sha512);
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
*
|
||||
* Copyright (C) 2001-2004 George Staikos <staikos@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef KWALLETBACKEND_H
|
||||
#define KWALLETBACKEND_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QMap>
|
||||
#include <kdemacros.h>
|
||||
|
||||
#include "kwalletentry.h"
|
||||
#include "backendpersisthandler.h"
|
||||
|
||||
#define KWALLET_SHA512_KEYSIZE 128
|
||||
|
||||
namespace KWallet {
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class MD5Digest : public QByteArray {
|
||||
public:
|
||||
MD5Digest() : QByteArray(16, 0) {}
|
||||
MD5Digest(const char *data) : QByteArray(data, 16) {}
|
||||
MD5Digest(const QByteArray& digest) : QByteArray(digest) {}
|
||||
virtual ~MD5Digest() {}
|
||||
|
||||
int operator<(const MD5Digest& r) const {
|
||||
int i = 0;
|
||||
char x, y;
|
||||
for (; i < 16; ++i) {
|
||||
x = at(i);
|
||||
y = r.at(i);
|
||||
if (x != y) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < 16 && x < y) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* @internal
|
||||
*/
|
||||
class KDE_EXPORT Backend {
|
||||
public:
|
||||
explicit Backend(const QString& name = QLatin1String("kdewallet"), bool isPath = false);
|
||||
~Backend();
|
||||
|
||||
// Open and unlock the wallet.
|
||||
// If opening succeeds, the password's hash will be remembered.
|
||||
// If opening fails, the password's hash will be cleared.
|
||||
int open(const QByteArray& password, WId w=0);
|
||||
|
||||
// Open and unlock the wallet using a pre-hashed password.
|
||||
// If opening succeeds, the password's hash will be remembered.
|
||||
// If opening fails, the password's hash will be cleared.
|
||||
int openPreHashed(const QByteArray &passwordHash);
|
||||
|
||||
// Close the wallet, losing any changes.
|
||||
// if save is true, the wallet is saved prior to closing it.
|
||||
int close(bool save = false);
|
||||
|
||||
// Write the wallet to disk
|
||||
int sync(WId w);
|
||||
|
||||
// Returns true if the current wallet is open.
|
||||
bool isOpen() const;
|
||||
|
||||
// Returns the current wallet name.
|
||||
const QString& walletName() const;
|
||||
|
||||
// The list of folders.
|
||||
QStringList folderList() const;
|
||||
|
||||
// Force creation of a folder.
|
||||
bool createFolder(const QString& f);
|
||||
|
||||
// Change the folder.
|
||||
void setFolder(const QString& f) { _folder = f; }
|
||||
|
||||
// Current folder. If empty, it's the global folder.
|
||||
const QString& folder() const { return _folder; }
|
||||
|
||||
// Does it have this folder?
|
||||
bool hasFolder(const QString& f) const { return _entries.contains(f); }
|
||||
|
||||
// Look up an entry. Returns null if it doesn't exist.
|
||||
Entry *readEntry(const QString& key);
|
||||
|
||||
// Look up a list of entries. Supports wildcards.
|
||||
// You delete the list
|
||||
QList<Entry*> readEntryList(const QString& key);
|
||||
|
||||
// Store an entry.
|
||||
void writeEntry(Entry *e);
|
||||
|
||||
// Does this folder contain this entry?
|
||||
bool hasEntry(const QString& key) const;
|
||||
|
||||
// Returns true if the entry was removed
|
||||
bool removeEntry(const QString& key);
|
||||
|
||||
// Returns true if the folder was removed
|
||||
bool removeFolder(const QString& f);
|
||||
|
||||
// The list of entries in this folder.
|
||||
QStringList entryList() const;
|
||||
|
||||
// Rename an entry in this folder.
|
||||
int renameEntry(const QString& oldName, const QString& newName);
|
||||
|
||||
// Set the password used for opening/closing the wallet.
|
||||
// This does not sync the wallet to disk!
|
||||
void setPassword(const QByteArray &password);
|
||||
|
||||
int ref() { return ++_ref; }
|
||||
|
||||
int deref();
|
||||
|
||||
int refCount() const { return _ref; }
|
||||
|
||||
static bool exists(const QString& wallet);
|
||||
|
||||
bool folderDoesNotExist(const QString& folder) const;
|
||||
|
||||
bool entryDoesNotExist(const QString& folder, const QString& entry) const;
|
||||
|
||||
static QString openRCToString(int rc);
|
||||
|
||||
void setCipherType(BackendCipherType ct);
|
||||
BackendCipherType cipherType() const { return _cipherType; }
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY( Backend )
|
||||
class BackendPrivate;
|
||||
BackendPrivate *const d;
|
||||
QString _name;
|
||||
QString _path;
|
||||
bool _open;
|
||||
QString _folder;
|
||||
int _ref;
|
||||
// Map Folder->Entries
|
||||
typedef QMap< QString, Entry* > EntryMap;
|
||||
typedef QMap< QString, EntryMap > FolderMap;
|
||||
FolderMap _entries;
|
||||
typedef QMap<MD5Digest, QList<MD5Digest> > HashMap;
|
||||
HashMap _hashes;
|
||||
QByteArray _passhash; // password hash used for saving the wallet
|
||||
BackendCipherType _cipherType; // the kind of encryption used for this wallet
|
||||
|
||||
friend class BlowfishPersistHandler;
|
||||
|
||||
// open the wallet with the password already set. This is
|
||||
// called internally by both open and openPreHashed.
|
||||
int openInternal(WId w=0);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
*
|
||||
* Copyright (C) 2001-2003 George Staikos <staikos@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "kwalletentry.h"
|
||||
|
||||
|
||||
using namespace KWallet;
|
||||
|
||||
|
||||
Entry::Entry() {
|
||||
}
|
||||
|
||||
Entry::~Entry() {
|
||||
_value.fill(0);
|
||||
}
|
||||
|
||||
const QString& Entry::key() const {
|
||||
return _key;
|
||||
}
|
||||
|
||||
|
||||
const QByteArray& Entry::value() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
||||
QString Entry::password() const {
|
||||
QString x;
|
||||
QDataStream qds(_value);
|
||||
qds >> x;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
void Entry::setValue(const QByteArray& val) {
|
||||
// do a direct copy from one into the other without
|
||||
// temporary variables
|
||||
_value.fill(0);
|
||||
_value = val;
|
||||
}
|
||||
|
||||
|
||||
void Entry::setValue(const QString& val) {
|
||||
_value.fill(0);
|
||||
QDataStream qds(&_value, QIODevice::WriteOnly);
|
||||
qds << val;
|
||||
}
|
||||
|
||||
|
||||
void Entry::setKey(const QString& key) {
|
||||
_key = key;
|
||||
}
|
||||
|
||||
|
||||
Wallet::EntryType Entry::type() const {
|
||||
return _type;
|
||||
}
|
||||
|
||||
|
||||
void Entry::setType(Wallet::EntryType type) {
|
||||
_type = type;
|
||||
}
|
||||
|
||||
|
||||
void Entry::copy(const Entry* x) {
|
||||
_type = x->_type;
|
||||
_key = x->_key;
|
||||
_value.fill(0);
|
||||
_value = x->_value;
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
*
|
||||
* Copyright (C) 2001-2003 George Staikos <staikos@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef KWALLETENTRY_H
|
||||
#define KWALLETENTRY_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
#include "kwalletbackend_export.h"
|
||||
#include "kwallet.h"
|
||||
|
||||
namespace KWallet {
|
||||
|
||||
/* @internal
|
||||
*/
|
||||
class KWALLETBACKEND_EXPORT Entry {
|
||||
public:
|
||||
Entry();
|
||||
~Entry();
|
||||
|
||||
const QString& key() const;
|
||||
const QByteArray& value() const;
|
||||
QString password() const;
|
||||
|
||||
void setValue(const QByteArray& val);
|
||||
void setValue(const QString& val);
|
||||
void setKey(const QString& key);
|
||||
|
||||
Wallet::EntryType type() const;
|
||||
void setType(Wallet::EntryType type);
|
||||
|
||||
void copy(const Entry* x);
|
||||
|
||||
private:
|
||||
QString _key;
|
||||
QByteArray _value;
|
||||
Wallet::EntryType _type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${CMAKE_CURRENT_BINARY_DIR}/..
|
||||
)
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(backendtest_SRCS backendtest.cpp )
|
||||
|
||||
|
||||
kde4_add_manual_test(backendtest ${backendtest_SRCS})
|
||||
|
||||
target_link_libraries(backendtest ${KDE4_KDEUI_LIBS} kwalletbackend )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(testbf_SRCS testbf.cpp )
|
||||
|
||||
|
||||
kde4_add_manual_test(testbf ${testbf_SRCS})
|
||||
|
||||
target_link_libraries(testbf ${KDE4_KDECORE_LIBS} kwalletbackend )
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kapplication.h>
|
||||
#include <klocale.h>
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include "kwalletbackend.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
KAboutData aboutData("backendtest", 0, ki18n("backendtest"), "version");
|
||||
KCmdLineArgs::init(argc, argv, &aboutData);
|
||||
KApplication a;
|
||||
|
||||
KWallet::Backend be("ktestwallet");
|
||||
printf("KWalletBackend constructed\n");
|
||||
|
||||
QByteArray apass("apassword", 9);
|
||||
QByteArray bpass("bpassword", 9);
|
||||
QByteArray cpass("cpassword", 9);
|
||||
|
||||
printf("Passwords initialised.\n");
|
||||
be.setPassword(apass);
|
||||
int rc = be.close(true);
|
||||
|
||||
printf("be.close(true) returned %d (should be -255)\n", rc);
|
||||
|
||||
rc = be.open(bpass);
|
||||
|
||||
printf("be.open(bpass) returned %d (should be 0 or 1)\n", rc);
|
||||
|
||||
rc = be.close(true);
|
||||
|
||||
printf("be.close(true) returned %d (should be 0)\n", rc);
|
||||
|
||||
rc = be.open(apass);
|
||||
|
||||
printf("be.open(apass) returned %d (should be negative)\n", rc);
|
||||
|
||||
rc = be.open(bpass);
|
||||
|
||||
printf("be.open(bpass) returned %d (should be 0)\n", rc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "blowfish.h"
|
||||
#include "cbc.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
BlockCipher *bf;
|
||||
char data[] = "This is a test.";
|
||||
char expect[] = "\x3f\x3c\x2d\xae\x8c\x7\x84\xf2\xa7\x6d\x28\xbd\xd\xb\xb8\x79";
|
||||
char key[] = "testkey";
|
||||
unsigned long et[] = {0x11223344};
|
||||
|
||||
printf("%d: 0x11 == %d and 0x44 == %d\n", ((unsigned char *)et)[0],
|
||||
0x11, 0x44);
|
||||
bf = new BlowFish();
|
||||
// bf = new CipherBlockChain(new BlowFish());
|
||||
|
||||
bf->setKey((void *)key, 7 * 8);
|
||||
|
||||
if (!bf->readyToGo()) {
|
||||
printf("Error: not ready to go!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("About to encrypt...\n"); fflush(stdout);
|
||||
if (-1 == bf->encrypt((void *)data, 16)) {
|
||||
printf("Error: encrypt failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Encryption done. data[] is now: ");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
printf("0x%x ", data[i] & 0xff);
|
||||
if ((data[i] & 0xff) != (expect[i] & 0xff)) {
|
||||
printf("Error. This byte failed the comparison. It should have been 0x%x.\n", expect[i] & 0xff);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
delete bf;
|
||||
bf = new BlowFish();
|
||||
// bf = new CipherBlockChain(new BlowFish());
|
||||
bf->setKey((void *)key, 7 * 8);
|
||||
|
||||
printf("About to decrypt...\n"); fflush(stdout);
|
||||
if (-1 == bf->decrypt((void *)data, 16)) {
|
||||
printf("Error: decrypt failed!\n");
|
||||
return -1;
|
||||
}
|
||||
//bf->decrypt((void *)(data+8), 8);
|
||||
|
||||
printf("All done! Result... data[] = \"%s\"\n", data);
|
||||
if (strcmp(data, "This is a test.")) {
|
||||
printf("ERROR. Decryption failed.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
delete bf;
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 2004 George Staikos <staikos@kde.org>
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "kbetterthankdialog.h"
|
||||
#include <kicon.h>
|
||||
|
||||
KBetterThanKDialog::KBetterThanKDialog( QWidget *parent )
|
||||
: QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
connect(_allowOnce, SIGNAL(clicked()), this, SLOT(allowOnceClicked()));
|
||||
connect(_allowAlways, SIGNAL(clicked()), this, SLOT(allowAlwaysClicked()));
|
||||
connect(_deny, SIGNAL(clicked()), this, SLOT(denyClicked()));
|
||||
connect(_denyForever, SIGNAL(clicked()), this, SLOT(denyForeverClicked()));
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::init()
|
||||
{
|
||||
_allowOnce->setIcon(KIcon("dialog-ok"));
|
||||
_allowAlways->setIcon(KIcon("dialog-ok"));
|
||||
_deny->setIcon(KIcon("dialog-cancel"));
|
||||
_denyForever->setIcon(KIcon("dialog-cancel"));
|
||||
|
||||
_allowOnce->setFocus();
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::setLabel( const QString & label )
|
||||
{
|
||||
_label->setText(label);
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::accept()
|
||||
{
|
||||
setResult(0);
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
setResult(2);
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::allowOnceClicked()
|
||||
{
|
||||
done(0);
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::allowAlwaysClicked()
|
||||
{
|
||||
done(1);
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::denyClicked()
|
||||
{
|
||||
done(2);
|
||||
}
|
||||
|
||||
void KBetterThanKDialog::denyForeverClicked()
|
||||
{
|
||||
done(3);
|
||||
}
|
||||
|
||||
#include "moc_kbetterthankdialog.cpp"
|
|
@ -1,47 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 2004 George Staikos <staikos@kde.org>
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef KBETTERTHANKDIALOG_H
|
||||
#define KBETTERTHANKDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_kbetterthankdialogbase.h"
|
||||
|
||||
class KBetterThanKDialog : public QDialog, private Ui_KBetterThanKDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KBetterThanKDialog( QWidget *parent = 0 );
|
||||
|
||||
void init();
|
||||
void setLabel( const QString &label );
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void accept();
|
||||
virtual void reject();
|
||||
|
||||
private Q_SLOTS:
|
||||
void allowOnceClicked();
|
||||
void allowAlwaysClicked();
|
||||
void denyClicked();
|
||||
void denyForeverClicked();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,107 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KBetterThanKDialogBase</class>
|
||||
<widget class="QDialog" name="KBetterThanKDialogBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>479</width>
|
||||
<height>109</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="_label"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>41</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="KPushButton" name="_allowOnce">
|
||||
<property name="text">
|
||||
<string>Allow &Once</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KPushButton" name="_allowAlways">
|
||||
<property name="text">
|
||||
<string>Allow &Always</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KPushButton" name="_deny">
|
||||
<property name="text">
|
||||
<string>&Deny</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KPushButton" name="_denyForever">
|
||||
<property name="text">
|
||||
<string>Deny &Forever</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KPushButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>kpushbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2003 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "ktimeout.h"
|
||||
#include <QtCore/QEvent>
|
||||
|
||||
KTimeout::KTimeout(QObject *parent)
|
||||
: QObject(parent) {
|
||||
}
|
||||
|
||||
KTimeout::~KTimeout() {
|
||||
}
|
||||
|
||||
void KTimeout::clear() {
|
||||
foreach (int timerId, _timers) {
|
||||
killTimer(timerId);
|
||||
}
|
||||
_timers.clear();
|
||||
}
|
||||
|
||||
void KTimeout::removeTimer(int id) {
|
||||
const int timerId = _timers.value(id, 0);
|
||||
if (timerId != 0) {
|
||||
killTimer(timerId);
|
||||
}
|
||||
_timers.remove(id);
|
||||
}
|
||||
|
||||
void KTimeout::addTimer(int id, int timeout) {
|
||||
if (_timers.contains(id)) {
|
||||
return;
|
||||
}
|
||||
_timers.insert(id, startTimer(timeout));
|
||||
}
|
||||
|
||||
void KTimeout::resetTimer(int id, int timeout) {
|
||||
int timerId = _timers.value(id, 0);
|
||||
if (timerId != 0) {
|
||||
killTimer(timerId);
|
||||
_timers.insert(id, startTimer(timeout));
|
||||
}
|
||||
}
|
||||
|
||||
void KTimeout::timerEvent(QTimerEvent* ev) {
|
||||
QHash<int, int>::const_iterator it = _timers.constBegin();
|
||||
for ( ; it != _timers.constEnd(); ++it) {
|
||||
if (it.value() == ev->timerId()) {
|
||||
emit timedOut(it.key());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_ktimeout.cpp"
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2003 George Staikos <staikos@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
#ifndef _KTIMEOUT_H_
|
||||
#define _KTIMEOUT_H_
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
// @internal
|
||||
class KTimeout : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
KTimeout(QObject *parent = 0);
|
||||
~KTimeout();
|
||||
|
||||
Q_SIGNALS:
|
||||
void timedOut(int id);
|
||||
|
||||
public Q_SLOTS:
|
||||
void resetTimer(int id, int timeout);
|
||||
void addTimer(int id, int timeout);
|
||||
void removeTimer(int id);
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent*);
|
||||
|
||||
private:
|
||||
QHash<int /*id*/,int /*timerId*/> _timers;
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,167 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
Exec=kwalletd
|
||||
X-KDE-ServiceTypes=
|
||||
# It is a server
|
||||
X-DBUS-StartupType=Unique
|
||||
X-KDE-StartupNotify=false
|
||||
Name=Wallet Server
|
||||
Name[ar]=خادم المحفظة
|
||||
Name[as]=Wallet Server
|
||||
Name[ast]=Sirvidor monederu
|
||||
Name[bg]=Сървър "портфейл"
|
||||
Name[bn]=ওয়ালেট সার্ভার
|
||||
Name[bn_IN]=Wallet সার্ভার
|
||||
Name[bs]=Server novčanika
|
||||
Name[ca]=Servidor de carteres
|
||||
Name[ca@valencia]=Servidor de carteres
|
||||
Name[cs]=Server úschovny
|
||||
Name[csb]=Serwera Wallet
|
||||
Name[da]=Wallet-server
|
||||
Name[de]=Passwortspeicher-Server
|
||||
Name[el]=Εξυπηρετητής πορτοφολιού
|
||||
Name[en_GB]=Wallet Server
|
||||
Name[eo]=Servilo de portilo
|
||||
Name[es]=Servidor de carteras
|
||||
Name[et]=Turvalaeka server
|
||||
Name[eu]=Zorro-zerbitzaria
|
||||
Name[fa]=خادم کیفپول
|
||||
Name[fi]=Lompakkopalvelin
|
||||
Name[fr]=Serveur de portefeuilles
|
||||
Name[fy]=Slúf tsjinner
|
||||
Name[ga]=Freastalaí Sparáin
|
||||
Name[gl]=Servidor de carteira
|
||||
Name[gu]=વોલેટ સર્વર
|
||||
Name[he]=שרת ארנק
|
||||
Name[hi]=वालेट सर्वर
|
||||
Name[hne]=वालेट सर्वर
|
||||
Name[hr]=Poslužitelj novčanika
|
||||
Name[hsb]=Móšnjowy serwer
|
||||
Name[hu]=Jelszótároló szolgáltatás
|
||||
Name[ia]=Servitor de Portafolio
|
||||
Name[id]=Server Dompet
|
||||
Name[is]=Veskisþjónn
|
||||
Name[it]=Server portafoglio
|
||||
Name[ja]=ウォレットサーバ
|
||||
Name[kk]=Әмиян сервері
|
||||
Name[km]=ម៉ាស៊ីនបម្រើកាបូប
|
||||
Name[kn]=ಹಸುಬೆಚೀಲ (ವಾಲೆಟ್) ಪರೀಚಾರಕ (ಸರ್ವರ್)
|
||||
Name[ko]=지갑 서버
|
||||
Name[ku]=Pêşkêşkera Wallet
|
||||
Name[lt]=Wallet serveris
|
||||
Name[lv]=Maka serveris
|
||||
Name[mai]=वालेट सर्वर
|
||||
Name[mk]=Сервер за паричници
|
||||
Name[ml]=വാലറ്റ് സര്വര്
|
||||
Name[mr]=पाकीट सर्व्हर
|
||||
Name[nb]=Lommebok-tjener
|
||||
Name[nds]=Knipp-Server
|
||||
Name[nl]=Portefeuilleserver
|
||||
Name[nn]=Lommeboktenar
|
||||
Name[or]=ୱାଲେଟ ସର୍ଭର
|
||||
Name[pa]=ਵਾਲਿਟ ਸਰਵਰ
|
||||
Name[pl]=Serwer Portfela
|
||||
Name[pt]=Servidor da Carteira
|
||||
Name[pt_BR]=Servidor de carteiras
|
||||
Name[ro]=Server de portofel
|
||||
Name[ru]=Wallet Server
|
||||
Name[si]=පසුම්බි ධාරකය
|
||||
Name[sk]=Wallet Server
|
||||
Name[sl]=Strežnik za listnico
|
||||
Name[sr]=Сервер новчаника
|
||||
Name[sr@ijekavian]=Сервер новчаника
|
||||
Name[sr@ijekavianlatin]=Server novčanika
|
||||
Name[sr@latin]=Server novčanika
|
||||
Name[sv]=Plånboksserver
|
||||
Name[ta]=Wallet Server
|
||||
Name[te]=వాలెట్ సెర్వర్
|
||||
Name[tg]=Сервери барномаи Ҳамён
|
||||
Name[th]=บริการกระเป๋าคุมข้อมูล
|
||||
Name[tr]=Cüzdan Sunucusu
|
||||
Name[ug]=ھەميان مۇلازىمېتىر
|
||||
Name[uk]=Сервер торбинки
|
||||
Name[vi]=Máy chủ Wallet
|
||||
Name[wa]=Sierveu poite-manoye
|
||||
Name[x-test]=xxWallet Serverxx
|
||||
Name[zh_CN]=钱包服务器
|
||||
Name[zh_TW]=錢包伺服器
|
||||
Comment=Wallet Server
|
||||
Comment[ar]=خادم المحفظة
|
||||
Comment[as]=Wallet Server
|
||||
Comment[ast]=Sirvidor monederu
|
||||
Comment[bg]=Сървър "портфейл" (Wallet)
|
||||
Comment[bn]=ওয়ালেট সার্ভার
|
||||
Comment[bn_IN]=Wallet সার্ভার
|
||||
Comment[bs]=Server novčanika
|
||||
Comment[ca]=Servidor de carteres
|
||||
Comment[ca@valencia]=Servidor de carteres
|
||||
Comment[cs]=Server úschovny
|
||||
Comment[csb]=Serwera Wallet
|
||||
Comment[da]=Wallet-server
|
||||
Comment[de]=Passwortspeicher-Server
|
||||
Comment[el]=Εξυπηρετητής πορτοφολιού
|
||||
Comment[en_GB]=Wallet Server
|
||||
Comment[eo]=Servilo de portilo
|
||||
Comment[es]=Servidor de carteras
|
||||
Comment[et]=Turvalaeka server
|
||||
Comment[eu]=Zorro-zerbitzaria
|
||||
Comment[fa]=خادم کیفپول
|
||||
Comment[fi]=Lompakkopalvelin
|
||||
Comment[fr]=Serveur de portefeuilles
|
||||
Comment[fy]=Slúf tsjinner
|
||||
Comment[ga]=Freastalaí Sparáin
|
||||
Comment[gl]=Servidor de carteira
|
||||
Comment[gu]=વોલેટ સર્વર
|
||||
Comment[he]=שרת ארנק
|
||||
Comment[hi]=वालेट सर्वर
|
||||
Comment[hne]=वालेट सर्वर
|
||||
Comment[hr]=Poslužitelj novčanika
|
||||
Comment[hsb]=Móšnjowy serwer
|
||||
Comment[hu]=Jelszótároló szolgáltatás
|
||||
Comment[ia]=Servitor de Portafolio
|
||||
Comment[id]=Server Dompet
|
||||
Comment[is]=Veskisþjónn
|
||||
Comment[it]=Server portafoglio
|
||||
Comment[ja]=ウォレットサーバ
|
||||
Comment[kk]=Әмиян сервері
|
||||
Comment[km]=ម៉ាស៊ីនបម្រើកាបូប
|
||||
Comment[kn]=ಹಸುಬೆಚೀಲ (ವಾಲೆಟ್) ಪರೀಚಾರಕ (ಸರ್ವರ್)
|
||||
Comment[ko]=지갑 서버
|
||||
Comment[ku]=Pêşkêşkera Wallet
|
||||
Comment[lt]=Wallet serveris
|
||||
Comment[lv]=Maka serveris
|
||||
Comment[mai]=वालेट सर्वर
|
||||
Comment[mk]=Сервер за паричници
|
||||
Comment[ml]=വാലറ്റ് സര്വര്
|
||||
Comment[mr]=पाकीट सर्व्हर
|
||||
Comment[nb]=Lommebok-tjener
|
||||
Comment[nds]=Knipp-Server
|
||||
Comment[nl]=Portefeuilleserver
|
||||
Comment[nn]=Lommeboktenar
|
||||
Comment[or]=ୱାଲେଟ ସର୍ଭର
|
||||
Comment[pa]=ਵਾਲਿਟ ਸਰਵਰ
|
||||
Comment[pl]=Serwer Portfela
|
||||
Comment[pt]=Servidor da Carteira
|
||||
Comment[pt_BR]=Servidor de carteiras
|
||||
Comment[ro]=Server de portofel
|
||||
Comment[ru]=Служба бумажника
|
||||
Comment[si]=පසුම්බි ධාරකය
|
||||
Comment[sk]=Wallet Server
|
||||
Comment[sl]=Strežnik za listnico
|
||||
Comment[sr]=Сервер новчаника
|
||||
Comment[sr@ijekavian]=Сервер новчаника
|
||||
Comment[sr@ijekavianlatin]=Server novčanika
|
||||
Comment[sr@latin]=Server novčanika
|
||||
Comment[sv]=Plånboksserver
|
||||
Comment[ta]=Wallet Server
|
||||
Comment[te]=వాలెట్ సెర్వర్
|
||||
Comment[tg]=Сервери барномаи Ҳамён
|
||||
Comment[th]=บริการกระเป๋าคุมข้อมูล
|
||||
Comment[tr]=Cüzdan Sunucusu
|
||||
Comment[ug]=ھەميان مۇلازىمېتىر
|
||||
Comment[uk]=Сервер торбинки
|
||||
Comment[vi]=Máy chủ Wallet
|
||||
Comment[wa]=Sierveu poite-manoye (wallet)
|
||||
Comment[x-test]=xxWallet Serverxx
|
||||
Comment[zh_CN]=钱包服务器
|
||||
Comment[zh_TW]=錢包伺服器
|
|
@ -1,248 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2002-2004 George Staikos <staikos@kde.org>
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
#ifndef _KWALLETD_H_
|
||||
#define _KWALLETD_H_
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtDBus/QDBusContext>
|
||||
#include <QtDBus/QDBusServiceWatcher>
|
||||
#include <QtDBus/QDBusInterface>
|
||||
|
||||
#include "kwalletbackend.h"
|
||||
#include "ktimeout.h"
|
||||
#include "kwalletsessionstore.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
class KDirWatch;
|
||||
class KTimeout;
|
||||
|
||||
// @Private
|
||||
class KWalletTransaction;
|
||||
class KWalletSessionStore;
|
||||
|
||||
class KWalletD : public QObject, protected QDBusContext
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KWalletD();
|
||||
virtual ~KWalletD();
|
||||
|
||||
public Q_SLOTS:
|
||||
// Is the wallet enabled? If not, all open() calls fail.
|
||||
bool isEnabled() const;
|
||||
|
||||
// Open and unlock the wallet
|
||||
int open(const QString& wallet, qlonglong wId, const QString& appid);
|
||||
|
||||
// Open and unlock the wallet with this path
|
||||
int openPath(const QString& path, qlonglong wId, const QString& appid);
|
||||
|
||||
// Open the wallet asynchronously
|
||||
int openAsync(const QString& wallet, qlonglong wId, const QString& appid,
|
||||
bool handleSession);
|
||||
|
||||
// Open and unlock the wallet with this path asynchronously
|
||||
int openPathAsync(const QString& path, qlonglong wId, const QString& appid,
|
||||
bool handleSession);
|
||||
|
||||
// Close and lock the wallet
|
||||
// If force = true, will close it for all users. Behave. This
|
||||
// can break applications, and is generally intended for use by
|
||||
// the wallet manager app only.
|
||||
int close(const QString& wallet, bool force);
|
||||
int close(int handle, bool force, const QString& appid);
|
||||
|
||||
// Save to disk but leave open
|
||||
void sync(int handle, const QString& appid);
|
||||
|
||||
// Physically deletes the wallet from disk.
|
||||
int deleteWallet(const QString& wallet);
|
||||
|
||||
// Returns true if the wallet is open
|
||||
bool isOpen(const QString& wallet);
|
||||
bool isOpen(int handle);
|
||||
|
||||
// List the users of this wallet
|
||||
QStringList users(const QString& wallet) const;
|
||||
|
||||
// Change the password of this wallet
|
||||
void changePassword(const QString& wallet, qlonglong wId, const QString& appid);
|
||||
|
||||
// A list of all wallets
|
||||
QStringList wallets() const;
|
||||
|
||||
// A list of all folders in this wallet
|
||||
QStringList folderList(int handle, const QString& appid);
|
||||
|
||||
// Does this wallet have this folder?
|
||||
bool hasFolder(int handle, const QString& folder, const QString& appid);
|
||||
|
||||
// Create this folder
|
||||
bool createFolder(int handle, const QString& folder, const QString& appid);
|
||||
|
||||
// Remove this folder
|
||||
bool removeFolder(int handle, const QString& folder, const QString& appid);
|
||||
|
||||
// List of entries in this folder
|
||||
QStringList entryList(int handle, const QString& folder, const QString& appid);
|
||||
|
||||
// Read an entry. If the entry does not exist, it just
|
||||
// returns an empty result. It is your responsibility to check
|
||||
// hasEntry() first.
|
||||
QByteArray readEntry(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
QByteArray readMap(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
QString readPassword(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
QVariantMap readEntryList(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
QVariantMap readMapList(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
QVariantMap readPasswordList(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
|
||||
// Rename an entry. rc=0 on success.
|
||||
int renameEntry(int handle, const QString& folder, const QString& oldName, const QString& newName, const QString& appid);
|
||||
|
||||
// Write an entry. rc=0 on success.
|
||||
int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value, int entryType, const QString& appid);
|
||||
int writeEntry(int handle, const QString& folder, const QString& key, const QByteArray& value, const QString& appid);
|
||||
int writeMap(int handle, const QString& folder, const QString& key, const QByteArray& value, const QString& appid);
|
||||
int writePassword(int handle, const QString& folder, const QString& key, const QString& value, const QString& appid);
|
||||
|
||||
// Does the entry exist?
|
||||
bool hasEntry(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
|
||||
// What type is the entry?
|
||||
int entryType(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
|
||||
// Remove an entry. rc=0 on success.
|
||||
int removeEntry(int handle, const QString& folder, const QString& key, const QString& appid);
|
||||
|
||||
// Disconnect an app from a wallet
|
||||
bool disconnectApplication(const QString& wallet, const QString& application);
|
||||
|
||||
void reconfigure();
|
||||
|
||||
// Determine
|
||||
bool folderDoesNotExist(const QString& wallet, const QString& folder);
|
||||
bool keyDoesNotExist(const QString& wallet, const QString& folder, const QString& key);
|
||||
|
||||
void closeAllWallets();
|
||||
|
||||
QString networkWallet();
|
||||
|
||||
QString localWallet();
|
||||
|
||||
void screenSaverChanged(bool);
|
||||
|
||||
// Open a wallet using a pre-hashed password. This is only useful in cooperation
|
||||
// with the kwallet PAM module. It's also less secure than manually entering the
|
||||
// password as the password hash is transmitted using D-Bus.
|
||||
int pamOpen(const QString &wallet, const QByteArray &passwordHash, int sessionTimeout);
|
||||
|
||||
Q_SIGNALS:
|
||||
void walletAsyncOpened(int id, int handle); // used to notify KWallet::Wallet
|
||||
void walletListDirty();
|
||||
void walletCreated(const QString& wallet);
|
||||
void walletOpened(const QString& wallet);
|
||||
void walletDeleted(const QString& wallet);
|
||||
void walletClosed(const QString& wallet);
|
||||
void walletClosed(int handle);
|
||||
void allWalletsClosed();
|
||||
void folderListUpdated(const QString& wallet);
|
||||
void folderUpdated(const QString&, const QString&);
|
||||
void applicationDisconnected(const QString& wallet, const QString& application);
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotServiceOwnerChanged(const QString& name, const QString &oldOwner,
|
||||
const QString &newOwner);
|
||||
void emitWalletListDirty();
|
||||
void timedOutClose(int handle);
|
||||
void timedOutSync(int handle);
|
||||
void notifyFailures();
|
||||
void processTransactions();
|
||||
void activatePasswordDialog();
|
||||
void connectToScreenSaver();
|
||||
|
||||
private:
|
||||
// Internal - open a wallet
|
||||
int internalOpen(const QString& appid, const QString& wallet, bool isPath, WId w,
|
||||
bool modal, const QString& service);
|
||||
// Internal - close this wallet.
|
||||
int internalClose(KWallet::Backend *w, int handle, bool force);
|
||||
|
||||
bool isAuthorizedApp(const QString& appid, const QString& wallet, WId w);
|
||||
// This also validates the handle. May return NULL.
|
||||
KWallet::Backend* getWallet(const QString& appid, int handle);
|
||||
// Generate a new unique handle.
|
||||
int generateHandle();
|
||||
// Emit signals about closing wallets
|
||||
void doCloseSignals(int,const QString&);
|
||||
void emitFolderUpdated(const QString&, const QString&);
|
||||
// Implicitly allow access for this application
|
||||
bool implicitAllow(const QString& wallet, const QString& app);
|
||||
bool implicitDeny(const QString& wallet, const QString& app);
|
||||
|
||||
void doTransactionChangePassword(const QString& appid, const QString& wallet, qlonglong wId);
|
||||
void doTransactionOpenCancelled(const QString& appid, const QString& wallet,
|
||||
const QString& service);
|
||||
int doTransactionOpen(const QString& appid, const QString& wallet, bool isPath,
|
||||
qlonglong wId, bool modal, const QString& service);
|
||||
void initiateSync(int handle);
|
||||
|
||||
void setupDialog( QWidget* dialog, WId wId, const QString& appid, bool modal );
|
||||
void checkActiveDialog();
|
||||
|
||||
QPair<int, KWallet::Backend*> findWallet(const QString& walletName) const;
|
||||
|
||||
typedef QHash<int, KWallet::Backend *> Wallets;
|
||||
Wallets _wallets;
|
||||
KDirWatch *_dw;
|
||||
int _failed;
|
||||
|
||||
// configuration values
|
||||
bool _leaveOpen, _closeIdle, _launchManager, _enabled;
|
||||
bool _openPrompt, _firstUse, _showingFailureNotify;
|
||||
int _idleTime;
|
||||
QMap<QString,QStringList> _implicitAllowMap, _implicitDenyMap;
|
||||
KTimeout _closeTimers;
|
||||
KTimeout _syncTimers;
|
||||
const int _syncTime;
|
||||
static bool _processing;
|
||||
|
||||
KWalletTransaction *_curtrans; // current transaction
|
||||
QList<KWalletTransaction*> _transactions;
|
||||
QPointer< QWidget > activeDialog;
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
QDBusInterface *screensaver;
|
||||
#endif
|
||||
|
||||
// sessions
|
||||
KWalletSessionStore _sessions;
|
||||
QDBusServiceWatcher _serviceWatcher;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,385 +0,0 @@
|
|||
[Global]
|
||||
IconName=kwalletmanager
|
||||
Comment=Wallet
|
||||
Comment[ar]=المحفظة
|
||||
Comment[ast]=Cartera
|
||||
Comment[bg]=Портфейл
|
||||
Comment[bn]=ওয়ালেট
|
||||
Comment[bs]=Novčanik
|
||||
Comment[ca]=Cartera
|
||||
Comment[ca@valencia]=Cartera
|
||||
Comment[cs]=Úschovna
|
||||
Comment[da]=Tegnebog
|
||||
Comment[de]=Passwortspeicher
|
||||
Comment[el]=Πορτοφόλι
|
||||
Comment[en_GB]=Wallet
|
||||
Comment[eo]=Portilo
|
||||
Comment[es]=Cartera
|
||||
Comment[et]=Turvalaegas
|
||||
Comment[eu]=Zorroa
|
||||
Comment[fa]=کیفپول
|
||||
Comment[fi]=Lompakko
|
||||
Comment[fr]=Portefeuille
|
||||
Comment[ga]=Sparán
|
||||
Comment[gl]=Carteira
|
||||
Comment[gu]=વોલેટ
|
||||
Comment[he]=ארנק
|
||||
Comment[hi]=बटुआ
|
||||
Comment[hr]=Novčanik
|
||||
Comment[hu]=Wallet
|
||||
Comment[ia]=Portafolio
|
||||
Comment[id]=Dompet
|
||||
Comment[is]=Veski
|
||||
Comment[it]=Portafoglio
|
||||
Comment[ja]=ウォレット
|
||||
Comment[kk]=Әмиян
|
||||
Comment[km]=ការបូប
|
||||
Comment[kn]=ವಾಲೆಟ್ (Wallet)
|
||||
Comment[ko]=지갑
|
||||
Comment[lt]=Piniginė
|
||||
Comment[lv]=Wallet
|
||||
Comment[mai]=वालेट
|
||||
Comment[ml]=വാലറ്റ്
|
||||
Comment[mr]=पाकीट
|
||||
Comment[nb]=Lommebok
|
||||
Comment[nds]=Knipp
|
||||
Comment[nl]=Portefeuille
|
||||
Comment[nn]=Lommebok
|
||||
Comment[pa]=ਵਾਲਿਟ
|
||||
Comment[pl]=Portfel
|
||||
Comment[pt]=Carteira
|
||||
Comment[pt_BR]=Carteira
|
||||
Comment[ro]=Portofel
|
||||
Comment[ru]=Бумажник
|
||||
Comment[si]=පසුම්බිය
|
||||
Comment[sk]=Wallet
|
||||
Comment[sl]=Listnica
|
||||
Comment[sr]=Новчаник
|
||||
Comment[sr@ijekavian]=Новчаник
|
||||
Comment[sr@ijekavianlatin]=Novčanik
|
||||
Comment[sr@latin]=Novčanik
|
||||
Comment[sv]=Plånbok
|
||||
Comment[tg]=Ҳамён
|
||||
Comment[th]=กระเป๋าคุมข้อมูล
|
||||
Comment[tr]=Cüzdan
|
||||
Comment[ug]=ھەميان
|
||||
Comment[uk]=Торбинка
|
||||
Comment[vi]=Wallet
|
||||
Comment[wa]=Poite-manoye
|
||||
Comment[x-test]=xxWalletxx
|
||||
Comment[zh_CN]=钱包
|
||||
Comment[zh_TW]=錢包
|
||||
Name=kwalletd
|
||||
Name[ar]=kwalletd
|
||||
Name[ast]=kwalletd
|
||||
Name[bg]=kwalletd
|
||||
Name[bn]=kwalletd
|
||||
Name[bs]=kwalletd
|
||||
Name[ca]=kwalletd
|
||||
Name[ca@valencia]=kwalletd
|
||||
Name[cs]=kwalletd
|
||||
Name[csb]=kwalletd
|
||||
Name[da]=kwalletd
|
||||
Name[de]=kwalletd
|
||||
Name[el]=kwalletd
|
||||
Name[en_GB]=kwalletd
|
||||
Name[eo]=kwalletd
|
||||
Name[es]=kwalletd
|
||||
Name[et]=kwalletd
|
||||
Name[eu]=kwalletd
|
||||
Name[fa]=kwalletd
|
||||
Name[fi]=kwalletd
|
||||
Name[fr]=kwalletd
|
||||
Name[fy]=kwalletd
|
||||
Name[ga]=kwalletd
|
||||
Name[gl]=kwalletd
|
||||
Name[gu]=kwalletd
|
||||
Name[he]=kwalletd
|
||||
Name[hi]=kwalletd
|
||||
Name[hr]=kwalletd
|
||||
Name[hu]=kwalletd
|
||||
Name[ia]=kwalletd
|
||||
Name[id]=kwalletd
|
||||
Name[is]=kwalletd
|
||||
Name[it]=kwalletd
|
||||
Name[ja]=kwalletd
|
||||
Name[kk]=kwalletd
|
||||
Name[km]=kwalletd
|
||||
Name[kn]=kwalletd
|
||||
Name[ko]=kwalletd
|
||||
Name[lt]=kwalletd
|
||||
Name[lv]=kwalletd
|
||||
Name[mai]=केवालेट्ड
|
||||
Name[mk]=kwalletd
|
||||
Name[ml]=കെവാലറ്റ്ഡി
|
||||
Name[mr]=के-वॉलेट-डि
|
||||
Name[nb]=kwalletd
|
||||
Name[nds]=KWalletd
|
||||
Name[nl]=kwalletd
|
||||
Name[nn]=kwalletd
|
||||
Name[pa]=kwalletd
|
||||
Name[pl]=kwalletd
|
||||
Name[pt]=kwalletd
|
||||
Name[pt_BR]=kwalletd
|
||||
Name[ro]=kwalletd
|
||||
Name[ru]=kwalletd
|
||||
Name[si]=kwalletd
|
||||
Name[sk]=kwalletd
|
||||
Name[sl]=kwalletd
|
||||
Name[sr]=kwalletd
|
||||
Name[sr@ijekavian]=kwalletd
|
||||
Name[sr@ijekavianlatin]=kwalletd
|
||||
Name[sr@latin]=kwalletd
|
||||
Name[sv]=kwalletd
|
||||
Name[tg]=kwalletd
|
||||
Name[th]=kwalletd
|
||||
Name[tr]=kwalletd
|
||||
Name[ug]=kwalletd
|
||||
Name[uk]=kwalletd
|
||||
Name[vi]=kwalletd
|
||||
Name[wa]=kwalletd
|
||||
Name[x-test]=xxkwalletdxx
|
||||
Name[zh_CN]=kwalletd
|
||||
Name[zh_TW]=kwalletd
|
||||
|
||||
[Event/needsPassword]
|
||||
Name=Needs password
|
||||
Name[ar]=يحتاج كلمة السر
|
||||
Name[ast]=Necesita contraseña
|
||||
Name[bg]=Нужна е парола
|
||||
Name[bn]=পাসওয়ার্ড প্রয়োজন
|
||||
Name[bs]=Zahtjeva lozinku
|
||||
Name[ca]=Cal una contrasenya
|
||||
Name[ca@valencia]=Cal contrasenya
|
||||
Name[cs]=Je třeba heslo
|
||||
Name[csb]=Wëmôgô zjinaczi parolë
|
||||
Name[da]=Kræver adgangskode
|
||||
Name[de]=Passwort erforderlich
|
||||
Name[el]=Απαιτείται κωδικός πρόσβασης
|
||||
Name[en_GB]=Needs password
|
||||
Name[eo]=Ĝi postulas pasvorton
|
||||
Name[es]=Necesita contraseña
|
||||
Name[et]=Vajalik on parool
|
||||
Name[eu]=Pasahitza behar du
|
||||
Name[fa]=نیاز به اسم رمز
|
||||
Name[fi]=Kysyy salasanaa
|
||||
Name[fr]=Nécessite un mot de passe
|
||||
Name[fy]=Hat wachwurd nedich
|
||||
Name[ga]=Focal faire de dhíth
|
||||
Name[gl]=Precisa dun contrasinal
|
||||
Name[gu]=પાસવર્ડ જરૂરી છે
|
||||
Name[he]=דרושה סיסמא
|
||||
Name[hi]=पासवर्ड चाहिए
|
||||
Name[hr]=Potrebna zaproka
|
||||
Name[hu]=Jelszó megadása szükséges
|
||||
Name[ia]=Il necessita de un contrasigno
|
||||
Name[id]=Memerlukan sandi
|
||||
Name[is]=Þarf lykilorð
|
||||
Name[it]=Serve una password
|
||||
Name[ja]=パスワードが必要
|
||||
Name[kk]=Парольді қажет етеді
|
||||
Name[km]=ត្រូវការពាក្យសម្ងាត់
|
||||
Name[kn]=ಗುಪ್ತಪದದ ಅಗತ್ಯವಿದೆ
|
||||
Name[ko]=암호 필요함
|
||||
Name[lt]=Reikia slaptažodžio
|
||||
Name[lv]=Nepieciešama parole
|
||||
Name[mai]=गुड़किल्लीकेँ जरूरत अछि
|
||||
Name[mk]=Потребна е лозинка
|
||||
Name[ml]=അടയാളവാക്ക് വേണം
|
||||
Name[mr]=गुप्तशब्द गरजेचा आहे
|
||||
Name[nb]=Trenger passord
|
||||
Name[nds]=Passwoort deit noot
|
||||
Name[nl]=Wachtwoord nodig
|
||||
Name[nn]=Passord er påkravd
|
||||
Name[pa]=ਪਾਸਵਰਡ ਚਾਹੀਦਾ ਹੈ
|
||||
Name[pl]=Potrzebne jest hasło
|
||||
Name[pt]=Necessita de senha
|
||||
Name[pt_BR]=Necessita senha
|
||||
Name[ro]=Necesită parolă
|
||||
Name[ru]=Требуется пароль
|
||||
Name[si]=රහස්පදය අවශ්ය වේ
|
||||
Name[sk]=Vyžaduje heslo
|
||||
Name[sl]=Potrebuje geslo
|
||||
Name[sr]=Захтева лозинку
|
||||
Name[sr@ijekavian]=Захтијева лозинку
|
||||
Name[sr@ijekavianlatin]=Zahtijeva lozinku
|
||||
Name[sr@latin]=Zahteva lozinku
|
||||
Name[sv]=Kräver lösenord
|
||||
Name[tg]=Парол лозим аст
|
||||
Name[th]=ต้องการรหัสผ่าน
|
||||
Name[tr]=Parola gerektirir
|
||||
Name[ug]=ئىم زۆرۈر
|
||||
Name[uk]=Потрібен пароль
|
||||
Name[vi]=Yêu cầu mật khẩu
|
||||
Name[wa]=Mezåjhe d' on scret
|
||||
Name[x-test]=xxNeeds passwordxx
|
||||
Name[zh_CN]=需要密码
|
||||
Name[zh_TW]=需要密碼
|
||||
Comment=The KDE Wallet Daemon requests a password
|
||||
Comment[ar]=مراقب محفظة كدي يطلب كلمة سر
|
||||
Comment[ast]=El degorriu del monederu de KDE requier una contraseña
|
||||
Comment[bg]=Услугата "портфейл" на KDE изисква парола
|
||||
Comment[bn]=কে.ডি.ই. ওয়ালেট ডিমন একটি পাসওয়ার্ড চাইছে
|
||||
Comment[bs]=KDE‑ov demon novčanika zahtjeva lozinku
|
||||
Comment[ca]=El dimoni de carteres del KDE demana una contrasenya
|
||||
Comment[ca@valencia]=El dimoni de carteres del KDE demana una contrasenya
|
||||
Comment[cs]=Démon úschovny KDE požaduje heslo
|
||||
Comment[csb]=Demóna KDE Wallet żądô parolë
|
||||
Comment[da]=Dæmonen for KDE's tegnebog anmoder om en adgangskode
|
||||
Comment[de]=Der Passwortspeicher benötigt ein Passwort
|
||||
Comment[el]=Ο δαίμονας πορτοφολιού του KDE απαιτεί έναν κωδικό πρόσβασης
|
||||
Comment[en_GB]=The KDE Wallet Dæmon requests a password
|
||||
Comment[eo]=la demono de portilo de KDE postulas pasvorton
|
||||
Comment[es]=El demonio de la cartera de KDE requiere una contraseña
|
||||
Comment[et]=KDE turvalaeka deemon nõuab parooli
|
||||
Comment[eu]=KDEren zorroaren daemon-ak pasahitza eskatzen du
|
||||
Comment[fa]=شبح Wallte کیدیای رمزعبوری را درخواست میکند
|
||||
Comment[fi]=KDE:n Lompakkotaustaprosessi pyytää salasanaa
|
||||
Comment[fr]=Le démon du portefeuille de KDE demande un mot de passe
|
||||
Comment[fy]=The KDE slûf daemon fereasket in wachtwurd
|
||||
Comment[ga]=Tá Deamhan Sparáin KDE ag iarraidh focal faire
|
||||
Comment[gl]=O Daemon de carteiras de KDE pide un contrasinal
|
||||
Comment[gu]=KDE વોલેટ ડેમને પાસવર્ડની માંગ કરી છે
|
||||
Comment[he]=תהליך הרקע של הארנק של KDE מבקש סיסמא
|
||||
Comment[hi]=केडीई वॉलेट डेमॉन एक पासवर्ड का अनुरोध करता है
|
||||
Comment[hr]=KDE-ov novčanik daemon zahtijeva zaporku
|
||||
Comment[hu]=A KDE jelszótároló szolgáltatás jelszót kér
|
||||
Comment[ia]=Le Demone KDE Wallet exige un contrasigno
|
||||
Comment[id]=Jurik Dompet KDE meminta sandi
|
||||
Comment[is]=KDE Veskispúkinn biður um lykilorð
|
||||
Comment[it]=Il demone dei portafogli di KDE richiede una password
|
||||
Comment[ja]=KDE ウォレットデーモンがパスワードを要求しています
|
||||
Comment[kk]=KDE әмиян қызметі паролін қажет етеді
|
||||
Comment[km]=ដេមិនកាបូបរបស់ KDE ស្នើពាក្យសម្ងាត់
|
||||
Comment[kn]=ಕೆಡಿಇ ವಾಲೆಟ್ ಡೀಮನ್ ಗುಪ್ತಪದಕ್ಕಾಗಿ ಮನವಿ ಸಲ್ಲಿಸುತ್ತದೆ
|
||||
Comment[ko]=KDE 지갑 데몬에서 암호를 물어봅니다
|
||||
Comment[lt]=KDE slaptažodinių tarnyba prašo slaptažodžio
|
||||
Comment[lv]=KDE Maka dēmons pieprasa paroli
|
||||
Comment[mai]=KDE वालेट डेमान एकटा कूटशब्दकेँ आग्रह करैत अछि
|
||||
Comment[mk]=KDE даемонот за паричник побарува лозинка
|
||||
Comment[ml]=കെഡിയിലെ വാലറ്റ് നിരന്തരപ്രവൃത്തി ഒരു അടയാളവാക്കു് ചോദിയ്ക്കുന്നു
|
||||
Comment[mr]=केडीई पाकीट डीमनने गुप्तशब्दाची मागणी केली आहे.
|
||||
Comment[nb]=KDEs lommeboknisse ber om et passord
|
||||
Comment[nds]=De KDE-Knipp-Dämoon bruukt en Passwoort
|
||||
Comment[nl]=De KDE-portefeuille-daemon vereist een wachtwoord
|
||||
Comment[nn]=Lommeboktenesta i KDE treng eit passord
|
||||
Comment[pa]=KDE ਵਾਲਿਟ ਡੈਮਨ ਨੇ ਪਾਸਵਰਡ ਦੀ ਮੰਗ ਕੀਤੀ ਹੈ
|
||||
Comment[pl]=Demon Portfela KDE wymaga hasła
|
||||
Comment[pt]=O Servidor da Carteira do KDE está a pedir uma senha
|
||||
Comment[pt_BR]=O servidor de carteiras do KDE está solicitando uma senha
|
||||
Comment[ro]=Demonul de portofel KDE cere o parolă
|
||||
Comment[ru]=Бумажник KDE запрашивает пароль
|
||||
Comment[si]=The KDE පසුම්බි ඩීමනය මුරපදයක් ඉල්ලයි
|
||||
Comment[sk]=Démon KDE Wallet vyžaduje heslo
|
||||
Comment[sl]=Ozadnji program KDE-jeve Listnice zahteva geslo
|
||||
Comment[sr]=КДЕ‑ов демон новчаника захтева лозинку
|
||||
Comment[sr@ijekavian]=КДЕ‑ов демон новчаника захтијева лозинку
|
||||
Comment[sr@ijekavianlatin]=KDE‑ov demon novčanika zahtijeva lozinku
|
||||
Comment[sr@latin]=KDE‑ov demon novčanika zahteva lozinku
|
||||
Comment[sv]=KDE-plånboksdemonen begär ett lösenord
|
||||
Comment[tg]=Модули ҳамёни KDE паролро дархост мекунад
|
||||
Comment[th]=บริการกระเป๋าคุมข้อมูลของ KDE ร้องขอรหัสผ่าน
|
||||
Comment[tr]=KDE Cüzdan Servisi bir parola ister
|
||||
Comment[ug]=KDE ھەميان نازارەتچىسى ئىم سورايدۇ
|
||||
Comment[uk]=Фонова служба торбинок KDE надіслала запит на пароль
|
||||
Comment[vi]=Trình nền Wallet KDE yêu cầu một mật khẩu
|
||||
Comment[wa]=Li démon poite-manoye di KDE dimande on scret
|
||||
Comment[x-test]=xxThe KDE Wallet Daemon requests a passwordxx
|
||||
Comment[zh_CN]=KDE 钱包守护程序请求密码
|
||||
Comment[zh_TW]=KDE 錢包守護程式需要密碼
|
||||
Action=Popup
|
||||
|
||||
[Event/syncFailed]
|
||||
Name=Sync Failed
|
||||
Name[ar]=فشل في المزامنة
|
||||
Name[bs]=Sinkronizacija nije uspjela
|
||||
Name[ca]=La sincronització ha fallat
|
||||
Name[ca@valencia]=La sincronització ha fallat
|
||||
Name[cs]=Synchronizace selhala
|
||||
Name[da]=Synkronisering mislykkedes
|
||||
Name[de]=Abgleich fehlgeschlagen
|
||||
Name[el]=Αποτυχία συγχρονισμού
|
||||
Name[en_GB]=Sync Failed
|
||||
Name[es]=Sincronización fallida
|
||||
Name[et]=Sünkroonimine nurjus
|
||||
Name[eu]=Sinkronizatzeak huts egin du
|
||||
Name[fa]=همگامسازی شکست خورد
|
||||
Name[fi]=Synkronointi epäonnistui
|
||||
Name[fr]=Échec de la synchronisation
|
||||
Name[gl]=Fallou a sincronización
|
||||
Name[hu]=A szinkronizálás meghiúsult
|
||||
Name[ia]=Il falleva synchronisar
|
||||
Name[id]=Sinkronisasi Gagal
|
||||
Name[is]=Samstilling mistókst
|
||||
Name[it]=Sincronizzazione non riuscita
|
||||
Name[kk]=Қадамдастыру жаңылды
|
||||
Name[ko]=동기화 실패
|
||||
Name[nb]=Synkronisering mislyktes
|
||||
Name[nds]=Synkroniseren is fehlslaan
|
||||
Name[nl]=Synchronisatie mislukt
|
||||
Name[nn]=Feil ved synkronisering
|
||||
Name[pa]=ਸਿੰਕ ਫੇਲ੍ਹ ਹੈ
|
||||
Name[pl]=Nieudana synchronizacja
|
||||
Name[pt]=A Sincronização Falhou
|
||||
Name[pt_BR]=Falha na sincronização
|
||||
Name[ro]=Sincronizare eșuată
|
||||
Name[ru]=Сбой записи
|
||||
Name[sk]=Synchronizácia zlyhala
|
||||
Name[sl]=Uskladitev spodletela
|
||||
Name[sr]=Синхронизација пропала
|
||||
Name[sr@ijekavian]=Синхронизација пропала
|
||||
Name[sr@ijekavianlatin]=Sinhronizacija propala
|
||||
Name[sr@latin]=Sinhronizacija propala
|
||||
Name[sv]=Synkronisering misslyckades
|
||||
Name[tr]=Eşitleme Başarısız
|
||||
Name[uk]=Спроба синхронізації зазнала невдачі
|
||||
Name[x-test]=xxSync Failedxx
|
||||
Name[zh_CN]=同步失败
|
||||
Name[zh_TW]=同步失敗
|
||||
Comment=KDE Wallet System failed to sync a wallet file to disk
|
||||
Comment[ar]=فشل نظام الحافظة في مزامنة ملف الحافظة إلى القرص
|
||||
Comment[bs]=Sistem KDE Wallet neuspio da sinhronizira datoteku novčanika s diskom
|
||||
Comment[ca]=El sistema de carteres del KDE ha fallat en sincronitzar un fitxer de cartera al disc
|
||||
Comment[ca@valencia]=El sistema de cartera del KDE ha fallat en sincronitzar un fitxer de cartera al disc
|
||||
Comment[cs]=Systému úschovny pro KDE selhala synchronizace úschovny na disk
|
||||
Comment[da]=KDE's tegnebogsystem kunne ikke synkronisere en tegnebogsfil til disken
|
||||
Comment[de]=Abgleich des KDE-Passwortspeicher mit einer Passwortspeicherdatei auf der Festplatte ist fehlgeschlagen.
|
||||
Comment[el]=Το σύστημα πορτοφολιού του KDE απέτυχε να συγχρονίσει ενός πορτοφολιού στον δίσκο
|
||||
Comment[en_GB]=KDE Wallet System failed to sync a wallet file to disk
|
||||
Comment[es]=El sistema de carteras de KDE ha fallado al sincronizar un archivo de cartera con el disco
|
||||
Comment[et]=KDE turvalaekasüsteem ei suutnud sünkroonida turvalaekafaili kettale
|
||||
Comment[eu]=KDE zorro-sistemak ezin izan du zorro bat diskora sinkronizatu
|
||||
Comment[fa]=سامانه کیفپول کیدیای در همگامسازی یک کیفپول در دیسک شکست خورد
|
||||
Comment[fi]=KDE:n lompakkojärjestelmä ei onnistunut tallentamaan lompakkotiedostoa levylle
|
||||
Comment[fr]=Le système du portefeuille de KDE n'a pas réussi à synchroniser un fichier de portefeuille sur le disque
|
||||
Comment[gl]=O sistema de carteiras de KDE non conseguiu sincronizar un ficheiro de carteira co disco
|
||||
Comment[hu]=A KDE jelszókezelő rendszer nem tudta szinkronizálni a jelszófájlt a lemezre
|
||||
Comment[ia]=Le sistema de portafolio de KDE (KDE Wallet System) falleva synchronisar un file de portafolio con le disco
|
||||
Comment[id]=Sistem Dompet KDE gagal sinkronisasi berkas dompet ke cakram
|
||||
Comment[is]=KDE Veskiskerfið náði ekki að samstilla veskisskrá á disk
|
||||
Comment[it]=Il sistema di portafogli di KDE non è riuscito a sincronizzare il file del portafogli sul disco
|
||||
Comment[kk]=KDE әмиян жүйесінің дискідегі әмиян файлымен қадамдастыру жаңылысы
|
||||
Comment[ko]=KDE 지갑 시스템과 디스크의 지갑 상태를 동기화할 수 없음
|
||||
Comment[nb]=KDE Wallet System klarte ikke å synkronisere en lommebokfil til disk
|
||||
Comment[nds]=Binnen KDE sien Knippsystem lett sik en Knipp nich mit de Datei op de Fastplaat synkroniseren
|
||||
Comment[nl]=Het lukte het KDE portefeuillesysteem niet om een portefeuillebestand naar schijf te synchroniseren
|
||||
Comment[nn]=Lommeboktenesta klarte ikkje synkronisera lommebokfila til disken
|
||||
Comment[pa]=KDE ਵਾਲਿਟ ਸਿਸਟਮ ਵਾਲਿਟ ਫਾਇਲ ਨੂੰ ਡਿਸਕ ਉੱਤੇ ਸਿੰਕ ਕਰਨ ਲਈ ਫੇਲ੍ਹ ਹੈ
|
||||
Comment[pl]=Nieudana synchronizacja pliku portfela przez System portfela KDE
|
||||
Comment[pt]=O sistema da Carteira do KDE não conseguiu sincronizar um ficheiro da carteira para o disco
|
||||
Comment[pt_BR]=O Sistema da Carteiras do KDE não conseguiu sincronizar um arquivo de carteira com o disco
|
||||
Comment[ro]=Sistemul de portofele KDE nu a putut sincroniza fișierul unui portofel cu discul
|
||||
Comment[ru]=Служба бумажника KDE не смогла записать файл бумажника на диск
|
||||
Comment[sk]=Systému KDE peňaženky sa nepodarilo synchronizovať súbor peňaženky na disk
|
||||
Comment[sl]=Sistem listnic za KDE ni uspel uskladiti datoteke z listnico na disku
|
||||
Comment[sr]=К‑новчаник не може да синхронизује фајл новчаника на диск
|
||||
Comment[sr@ijekavian]=К‑новчаник не може да синхронизује фајл новчаника на диск
|
||||
Comment[sr@ijekavianlatin]=K‑novčanik ne može da sinhronizuje fajl novčanika na disk
|
||||
Comment[sr@latin]=K‑novčanik ne može da sinhronizuje fajl novčanika na disk
|
||||
Comment[sv]=KDE:s plånbokssystem misslyckades synkronisera en plånboksfil till disk
|
||||
Comment[tr]=KDE Cüzdan Sistemi diske bir cüzdan dosyası eşitlerken başarısız oldu
|
||||
Comment[uk]=Система торбинок KDE не змогла синхронізувати дані файла торбинок з диском
|
||||
Comment[x-test]=xxKDE Wallet System failed to sync a wallet file to diskxx
|
||||
Comment[zh_CN]=KDE 钱包系统无法将钱包文件写入磁盘
|
||||
Comment[zh_TW]=KDE 錢包系統在將錢包檔同步到磁碟時失敗
|
||||
Action=Popup
|
|
@ -1,173 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE Wallet Daemon
|
||||
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "kwalletsessionstore.h"
|
||||
|
||||
class KWalletSessionStore::Session
|
||||
{
|
||||
public:
|
||||
QString m_service; // client dbus service (or empty)
|
||||
int m_handle; // backend handle
|
||||
};
|
||||
|
||||
KWalletSessionStore::KWalletSessionStore()
|
||||
{
|
||||
}
|
||||
|
||||
KWalletSessionStore::~KWalletSessionStore()
|
||||
{
|
||||
Q_FOREACH(const QList<Session*> &l, m_sessions) {
|
||||
qDeleteAll(l);
|
||||
}
|
||||
}
|
||||
|
||||
void KWalletSessionStore::addSession(const QString &appid, const QString &service, int handle)
|
||||
{
|
||||
Session *sess = new Session();
|
||||
sess->m_service = service;
|
||||
sess->m_handle = handle;
|
||||
m_sessions[appid].append(sess);
|
||||
}
|
||||
|
||||
bool KWalletSessionStore::hasSession(const QString &appid, int handle) const
|
||||
{
|
||||
if (!m_sessions.contains(appid)) {
|
||||
return false;
|
||||
} else if (handle == -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<Session*>::const_iterator it;
|
||||
QList<Session*>::const_iterator end = m_sessions[appid].constEnd();
|
||||
for (it = m_sessions[appid].constBegin(); it != end; ++it) {
|
||||
Q_ASSERT(*it);
|
||||
if ((*it)->m_handle == handle) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<KWalletAppHandlePair> KWalletSessionStore::findSessions(const QString &service) const
|
||||
{
|
||||
QList<KWalletAppHandlePair> rc;
|
||||
QList<QString> sessionKeys(m_sessions.keys());
|
||||
Q_FOREACH(const QString &appid, sessionKeys) {
|
||||
Q_FOREACH(const Session *sess, m_sessions[appid]) {
|
||||
Q_ASSERT(sess);
|
||||
if (sess->m_service == service) {
|
||||
rc.append(qMakePair(appid, sess->m_handle));
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool KWalletSessionStore::removeSession(const QString &appid, const QString &service, int handle)
|
||||
{
|
||||
if (!m_sessions.contains(appid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<Session*>::const_iterator it;
|
||||
QList<Session*>::const_iterator end = m_sessions[appid].constEnd();
|
||||
for (it = m_sessions[appid].constBegin(); it != end; ++it) {
|
||||
Q_ASSERT(*it);
|
||||
if ((*it)->m_service == service && (*it)->m_handle == handle) {
|
||||
Session *sess = *it;
|
||||
m_sessions[appid].removeAll(sess);
|
||||
delete sess;
|
||||
if (m_sessions[appid].isEmpty()) {
|
||||
m_sessions.remove(appid);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int KWalletSessionStore::removeAllSessions(const QString &appid, int handle)
|
||||
{
|
||||
if (!m_sessions.contains(appid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<Session*>::iterator it;
|
||||
QList<Session*>::iterator end = m_sessions[appid].end();
|
||||
for (it = m_sessions[appid].begin(); it != end; ++it) {
|
||||
Q_ASSERT(*it);
|
||||
if ((*it)->m_handle == handle) {
|
||||
delete *it;
|
||||
*it = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int removed = m_sessions[appid].removeAll(0);
|
||||
if (m_sessions[appid].isEmpty()) {
|
||||
m_sessions.remove(appid);
|
||||
}
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
int KWalletSessionStore::removeAllSessions(int handle) {
|
||||
QList<QString> appremove;
|
||||
int numrem = 0;
|
||||
QList<QString> sessionKeys(m_sessions.keys());
|
||||
Q_FOREACH(const QString &appid, sessionKeys) {
|
||||
QList<Session*>::iterator it;
|
||||
QList<Session*>::iterator end = m_sessions[appid].end();
|
||||
for (it = m_sessions[appid].begin(); it != end; ++it) {
|
||||
Q_ASSERT(*it);
|
||||
if ((*it)->m_handle == handle) {
|
||||
delete *it;
|
||||
*it = 0;
|
||||
numrem++;
|
||||
}
|
||||
}
|
||||
// remove all zeroed sessions
|
||||
m_sessions[appid].removeAll(0);
|
||||
if (m_sessions[appid].isEmpty()) {
|
||||
appremove.append(appid);
|
||||
}
|
||||
}
|
||||
|
||||
// now remove all applications without sessions
|
||||
Q_FOREACH(const QString &appid, appremove) {
|
||||
m_sessions.remove(appid);
|
||||
}
|
||||
|
||||
return numrem;
|
||||
}
|
||||
|
||||
QStringList KWalletSessionStore::getApplications(int handle) const {
|
||||
QStringList rc;
|
||||
Q_FOREACH(const QString &appid, m_sessions.uniqueKeys()) {
|
||||
if (hasSession(appid, handle)) {
|
||||
rc.append(appid);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE Wallet Daemon
|
||||
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef _KWALLETSESSIONSTORE_H_
|
||||
#define _KWALLETSESSIONSTORE_H_
|
||||
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QHash>
|
||||
#include <QStringList>
|
||||
|
||||
typedef QPair<QString,int> KWalletAppHandlePair;
|
||||
|
||||
class KWalletSessionStore
|
||||
{
|
||||
public:
|
||||
KWalletSessionStore();
|
||||
~KWalletSessionStore();
|
||||
|
||||
// add a new session
|
||||
void addSession(const QString &appid, const QString &service, int handle);
|
||||
// check if the application has a session using that handle
|
||||
bool hasSession(const QString &appid, int handle = -1) const;
|
||||
// find all sessions a service has
|
||||
QList<KWalletAppHandlePair> findSessions(const QString &service) const;
|
||||
// remove a specific session
|
||||
bool removeSession(const QString &appid, const QString &service, int handle);
|
||||
// remove all sessions an application has to a specific handle
|
||||
int removeAllSessions(const QString &appid, int handle);
|
||||
// remove all sessions related to a handle
|
||||
int removeAllSessions(int handle);
|
||||
// get all applications using a handle
|
||||
QStringList getApplications(int handle) const;
|
||||
|
||||
private:
|
||||
class Session;
|
||||
QHash< QString,QList<Session*> > m_sessions; // appid => session
|
||||
};
|
||||
|
||||
#endif // _KWALLETSESSIONSTORE_H_
|
|
@ -1,178 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 2004 George Staikos <staikos@kde.org>
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "kwalletwizard.h"
|
||||
#include "moc_kwalletwizard.cpp"
|
||||
|
||||
#include "ui_kwalletwizardpageexplanation.h"
|
||||
#include "ui_kwalletwizardpageintro.h"
|
||||
#include "ui_kwalletwizardpageoptions.h"
|
||||
#include "ui_kwalletwizardpagepassword.h"
|
||||
|
||||
#include <QButtonGroup>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kiconloader.h>
|
||||
|
||||
class PageIntro : public QWizardPage
|
||||
{
|
||||
public:
|
||||
PageIntro(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
ui.ktitlewidget->setText("<h1>" + i18n("KWallet") + "</h1>");
|
||||
|
||||
int iconSize = 3 * fontMetrics().height();
|
||||
// round to multiple of 16
|
||||
iconSize = (iconSize + 8) & ~15;
|
||||
QPixmap pix = KIconLoader::global()->loadIcon("kwalletmanager", KIconLoader::Dialog, iconSize);
|
||||
ui.ktitlewidget->setPixmap(pix);
|
||||
|
||||
bg = new QButtonGroup(this);
|
||||
bg->setExclusive(true);
|
||||
bg->addButton(ui._basic, 0);
|
||||
bg->addButton(ui._advanced, 1);
|
||||
|
||||
// force the "basic" button to be selected
|
||||
ui._basic->setChecked(true);
|
||||
}
|
||||
|
||||
QButtonGroup *bg;
|
||||
|
||||
private:
|
||||
Ui::KWalletWizardPageIntro ui;
|
||||
};
|
||||
|
||||
class PagePassword : public QWizardPage
|
||||
{
|
||||
public:
|
||||
PagePassword(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
|
||||
ui.setupUi(this);
|
||||
|
||||
registerField("useWallet", ui._useWallet);
|
||||
registerField("pass1", ui._pass1);
|
||||
registerField("pass2", ui._pass2);
|
||||
|
||||
connect(ui._useWallet, SIGNAL(clicked()), parent, SLOT(passwordPageUpdate()));
|
||||
connect(ui._pass1, SIGNAL(textChanged(QString)), parent, SLOT(passwordPageUpdate()));
|
||||
connect(ui._pass2, SIGNAL(textChanged(QString)), parent, SLOT(passwordPageUpdate()));
|
||||
}
|
||||
|
||||
virtual int nextId() const
|
||||
{
|
||||
return static_cast<KWalletWizard*>(wizard())->wizardType() == KWalletWizard::Basic ? -1 : KWalletWizard::PageOptionsId;
|
||||
}
|
||||
|
||||
void setMatchLabelText(const QString &text)
|
||||
{
|
||||
ui._matchLabel->setText(text);
|
||||
}
|
||||
|
||||
private:
|
||||
Ui::KWalletWizardPagePassword ui;
|
||||
};
|
||||
|
||||
class PageOptions : public QWizardPage
|
||||
{
|
||||
public:
|
||||
PageOptions(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
registerField("closeWhenIdle", ui._closeIdle);
|
||||
registerField("networkWallet", ui._networkWallet);
|
||||
}
|
||||
|
||||
private:
|
||||
Ui::KWalletWizardPageOptions ui;
|
||||
};
|
||||
|
||||
|
||||
class PageExplanation : public QWizardPage
|
||||
{
|
||||
public:
|
||||
PageExplanation(QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
setFinalPage(true);
|
||||
}
|
||||
|
||||
private:
|
||||
Ui::KWalletWizardPageExplanation ui;
|
||||
};
|
||||
|
||||
|
||||
|
||||
KWalletWizard::KWalletWizard( QWidget *parent )
|
||||
: QWizard(parent)
|
||||
{
|
||||
setOption(HaveFinishButtonOnEarlyPages);
|
||||
|
||||
m_pageIntro = new PageIntro(this);
|
||||
setPage(PageIntroId, m_pageIntro);
|
||||
m_pagePasswd = new PagePassword(this);
|
||||
setPage(PagePasswordId, m_pagePasswd);
|
||||
setPage(PageOptionsId, new PageOptions(this));
|
||||
setPage(PageExplanationId, new PageExplanation(this));
|
||||
|
||||
resize(500, 420);
|
||||
}
|
||||
|
||||
void KWalletWizard::passwordPageUpdate()
|
||||
{
|
||||
bool complete = true;
|
||||
if (field("useWallet").toBool()) {
|
||||
if (field("pass1").toString() == field("pass2").toString()) {
|
||||
if (field("pass1").toString().isEmpty()) {
|
||||
m_pagePasswd->setMatchLabelText(i18n("<qt>Password is empty. <b>(WARNING: Insecure)</b></qt>"));
|
||||
} else {
|
||||
m_pagePasswd->setMatchLabelText(i18n("Passwords match."));
|
||||
}
|
||||
} else {
|
||||
m_pagePasswd->setMatchLabelText(i18n("Passwords do not match."));
|
||||
complete = false;
|
||||
}
|
||||
} else {
|
||||
m_pagePasswd->setMatchLabelText(QString());
|
||||
}
|
||||
button(wizardType() == Basic ? FinishButton : NextButton)->setEnabled(complete);
|
||||
}
|
||||
|
||||
KWalletWizard::WizardType KWalletWizard::wizardType() const
|
||||
{
|
||||
return (KWalletWizard::WizardType)m_pageIntro->bg->checkedId();
|
||||
}
|
||||
|
||||
void KWalletWizard::initializePage(int id)
|
||||
{
|
||||
switch (id) {
|
||||
case PagePasswordId: {
|
||||
bool islast = m_pageIntro->bg->checkedId() == 0;
|
||||
m_pagePasswd->setFinalPage(islast);
|
||||
button(NextButton)->setVisible(!islast);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/* This file is part of the KDE libraries
|
||||
Copyright (C) 2004 George Staikos <staikos@kde.org>
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef KWALLETWIZARD_H
|
||||
#define KWALLETWIZARD_H
|
||||
|
||||
#include <QWizard>
|
||||
|
||||
class PagePassword;
|
||||
class PageIntro;
|
||||
|
||||
class KWalletWizard : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
enum WizardType
|
||||
{
|
||||
Basic,
|
||||
Advanced
|
||||
};
|
||||
|
||||
static const int PageIntroId = 0;
|
||||
static const int PagePasswordId = 1;
|
||||
static const int PageOptionsId = 2;
|
||||
static const int PageExplanationId = 3;
|
||||
|
||||
KWalletWizard( QWidget *parent = 0 );
|
||||
|
||||
WizardType wizardType() const;
|
||||
|
||||
protected:
|
||||
virtual void initializePage(int id);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void passwordPageUpdate();
|
||||
|
||||
private:
|
||||
PageIntro *m_pageIntro;
|
||||
PagePassword *m_pagePasswd;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KWalletWizardPageExplanation</class>
|
||||
<widget class="QWidget" name="KWalletWizardPageExplanation">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>478</width>
|
||||
<height>215</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel2_3">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>The KDE Wallet system stores your data in a <span style=" font-style:italic;">wallet</span> file on your local hard disk. The data is only written in the encrypted form of your choice - blowfish algorithm with your password as the key. When a wallet is opened, the wallet manager application will launch and display an icon in the system tray. You can use this application to manage all of your wallets. It even permits you to drag wallets and wallet contents, allowing you to easily copy a wallet to a remote system.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,127 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KWalletWizardPageIntro</class>
|
||||
<widget class="QWidget" name="KWalletWizardPageIntro">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>449</width>
|
||||
<height>327</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="KTitleWidget" name="ktitlewidget">
|
||||
<property name="comment">
|
||||
<string>The KDE Wallet System</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Welcome to KWallet, the KDE Wallet System. KWallet allows you to store your passwords and other personal information on disk in an encrypted file, preventing others from viewing the information. This wizard will tell you about KWallet and help you configure it for the first time.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="_basic">
|
||||
<property name="text">
|
||||
<string>&Basic setup (recommended)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="_advanced">
|
||||
<property name="text">
|
||||
<string>&Advanced setup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KTitleWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ktitlewidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,79 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWalletWizardPageOptions</class>
|
||||
<widget class="QWidget" name="KWalletWizardPageOptions" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>214</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1_3" >
|
||||
<property name="text" >
|
||||
<string>The KDE Wallet system allows you to control the level of security of your personal data. Some of these settings do impact usability. While the default settings are generally acceptable for most users, you may wish to change some of them. You may further tune these settings from the KWallet control module.</string>
|
||||
</property>
|
||||
<property name="textFormat" >
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_closeIdle" >
|
||||
<property name="text" >
|
||||
<string>Automatically close idle wallets</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_networkWallet" >
|
||||
<property name="text" >
|
||||
<string>Store network passwords and local passwords in separate wallet files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,282 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWalletWizardPagePassword</class>
|
||||
<widget class="QWidget" name="KWalletWizardPagePassword" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>526</width>
|
||||
<height>401</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" colspan="4" >
|
||||
<widget class="QLabel" name="textLabel3" >
|
||||
<property name="text" >
|
||||
<string>Various applications may attempt to use the KDE wallet to store passwords or other information such as web form data and cookies. If you would like these applications to use the wallet, you must enable it now and choose a password. The password you choose <i>cannot</i> be recovered if it is lost, and will allow anyone who knows it to obtain all the information contained in the wallet.</string>
|
||||
</property>
|
||||
<property name="textFormat" >
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4" >
|
||||
<widget class="QCheckBox" name="_useWallet" >
|
||||
<property name="text" >
|
||||
<string>Yes, I wish to use the KDE wallet to store my personal information.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>51</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>111</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1_3" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Enter a new password:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>_pass1</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel2_3" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Verify password:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>_pass2</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="_pass1" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode" >
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="_pass2" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode" >
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="3" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>101</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="4" >
|
||||
<widget class="QLabel" name="_matchLabel" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>_useWallet</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>textLabel1_3</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>108</x>
|
||||
<y>119</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>217</x>
|
||||
<y>226</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_useWallet</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>_pass1</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>455</x>
|
||||
<y>125</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>394</x>
|
||||
<y>226</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_useWallet</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>textLabel2_3</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>60</x>
|
||||
<y>120</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>131</x>
|
||||
<y>257</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_useWallet</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>_pass2</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>487</x>
|
||||
<y>124</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>371</x>
|
||||
<y>257</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_useWallet</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>_pass1</receiver>
|
||||
<slot>setFocus()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>259</x>
|
||||
<y>119</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>269</x>
|
||||
<y>237</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,193 +0,0 @@
|
|||
/**
|
||||
* This file is part of the KDE project
|
||||
* Copyright (C) 2008 Michael Leupold <lemma@confuego.org>
|
||||
* Copyright (C) 2014 Alejandro Fiestas Olivares <afiestas@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public License
|
||||
* along with this library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <kuniqueapplication.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <klocale.h>
|
||||
#include <qplatformdefs.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
#include "kwalletd.h"
|
||||
#include "backend/kwalletbackend.h" // For the hash size
|
||||
|
||||
#define BSIZE 1000
|
||||
|
||||
static int pipefd = 0;
|
||||
static int socketfd = 0;
|
||||
|
||||
static bool isWalletEnabled()
|
||||
{
|
||||
KConfig cfg("kwalletrc");
|
||||
KConfigGroup walletGroup(&cfg, "Wallet");
|
||||
return walletGroup.readEntry("Enabled", true);
|
||||
}
|
||||
|
||||
//Waits until the PAM_MODULE sends the hash
|
||||
static char *waitForHash()
|
||||
{
|
||||
printf("kwalletd: Waiting for hash on %d-\n", pipefd);
|
||||
int totalRead = 0;
|
||||
int readBytes = 0;
|
||||
int attemps = 0;
|
||||
char *buf = (char*)malloc(sizeof(char) * KWALLET_SHA512_KEYSIZE);
|
||||
memset(buf, '\0', KWALLET_SHA512_KEYSIZE);
|
||||
while(totalRead != KWALLET_SHA512_KEYSIZE) {
|
||||
readBytes = read(pipefd, buf + totalRead, KWALLET_SHA512_KEYSIZE - totalRead);
|
||||
if (readBytes == -1 || attemps > 5) {
|
||||
free(buf);
|
||||
return NULL;
|
||||
}
|
||||
totalRead += readBytes;
|
||||
++attemps;
|
||||
}
|
||||
|
||||
close(pipefd);
|
||||
return buf;
|
||||
}
|
||||
|
||||
//Waits until startkde sends the environment variables
|
||||
static int waitForEnvironment()
|
||||
{
|
||||
printf("kwalletd: waitingForEnvironment on: %d\n", socketfd);
|
||||
|
||||
int s2;
|
||||
struct sockaddr_un remote;
|
||||
QT_SOCKLEN_T t = sizeof(remote);
|
||||
if ((s2 = accept(socketfd, (struct sockaddr *)&remote, &t)) == -1) {
|
||||
fprintf(stdout, "kwalletd: Couldn't accept incoming connection\n");
|
||||
return -1;
|
||||
}
|
||||
printf("kwalletd: client connected\n");
|
||||
|
||||
char str[BSIZE];
|
||||
memset(str, '\0', sizeof(char) * BSIZE);
|
||||
|
||||
int chop = 0;
|
||||
FILE *s3 = fdopen(s2, "r");
|
||||
while(!feof(s3)) {
|
||||
if (fgets(str, BSIZE, s3)) {
|
||||
chop = strlen(str) - 1;
|
||||
str[chop] = '\0';
|
||||
putenv(strdup(str));
|
||||
}
|
||||
}
|
||||
printf("kwalletd: client disconnected\n");
|
||||
close(socketfd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char* checkPamModule(int argc, char **argv)
|
||||
{
|
||||
printf("Checking for pam module\n");
|
||||
char *hash = NULL;
|
||||
int x = 1;
|
||||
for (; x < argc; ++x) {
|
||||
if (strcmp(argv[x], "--pam-login") != 0) {
|
||||
continue;
|
||||
}
|
||||
printf("Got pam-login\n");
|
||||
argv[x] = NULL;
|
||||
x++;
|
||||
//We need at least 2 extra arguments after --pam-login
|
||||
if (x + 1 > argc) {
|
||||
printf("Invalid arguments (less than needed)\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//first socket for the hash, comes from a pipe
|
||||
pipefd = atoi(argv[x]);
|
||||
argv[x] = NULL;
|
||||
x++;
|
||||
//second socket for environemtn, comes from a localsock
|
||||
socketfd = atoi(argv[x]);
|
||||
argv[x] = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pipefd || !socketfd) {
|
||||
printf("Lacking a socket, pipe: %d, env:%d\n", pipefd, socketfd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hash = waitForHash();
|
||||
|
||||
if (hash == NULL || waitForEnvironment() == -1) {
|
||||
printf("Hash or environment not received\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// check if kwallet is disabled
|
||||
const bool enabled = isWalletEnabled();
|
||||
if (!enabled) {
|
||||
kDebug() << "kwalletd is disabled!";
|
||||
}
|
||||
|
||||
char *hash = NULL;
|
||||
if (enabled && getenv("PAM_KWALLET_LOGIN")) {
|
||||
hash = checkPamModule(argc, argv);
|
||||
}
|
||||
|
||||
KAboutData aboutdata("kwalletd", 0, ki18n("KDE Wallet Service"),
|
||||
"0.3", ki18n("KDE Wallet Service"),
|
||||
KAboutData::License_LGPL, ki18n("(C) 2002-2008 George Staikos, Michael Leupold, Thiago Maceira, Valentin Rusu"));
|
||||
aboutdata.addAuthor(ki18n("Michael Leupold"),ki18n("Maintainer"),"lemma@confuego.org");
|
||||
aboutdata.addAuthor(ki18n("George Staikos"),ki18n("Former maintainer"),"staikos@kde.org");
|
||||
aboutdata.addAuthor(ki18n("Thiago Maceira"),ki18n("D-Bus Interface"),"thiago@kde.org");
|
||||
|
||||
aboutdata.setProgramIconName("kwalletmanager");
|
||||
|
||||
KCmdLineArgs::init( argc, argv, &aboutdata );
|
||||
KUniqueApplication::addCmdLineOptions();
|
||||
KUniqueApplication app;
|
||||
|
||||
// This app is started automatically, no need for session management
|
||||
app.disableSessionManagement();
|
||||
app.setQuitOnLastWindowClosed( false );
|
||||
|
||||
if (!KUniqueApplication::start()) {
|
||||
kDebug() << "kwalletd is already running!";
|
||||
return (0);
|
||||
}
|
||||
|
||||
kDebug() << "kwalletd started";
|
||||
KWalletD walletd;
|
||||
if (hash) {
|
||||
kDebug() << "LOGIN INSIDE!";
|
||||
QByteArray passHash(hash, KWALLET_SHA512_KEYSIZE);
|
||||
int wallet = walletd.pamOpen(KWallet::Wallet::LocalWallet(), passHash, 0);
|
||||
kDebug() << "Wallet handler: " << wallet;
|
||||
free(hash);
|
||||
} else {
|
||||
kDebug() << "Not pam login";
|
||||
}
|
||||
return app.exec();
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
[D-BUS Service]
|
||||
Name=org.kde.kwalletd
|
||||
Exec=@CMAKE_INSTALL_PREFIX@/bin/kwalletd
|
|
@ -1,92 +0,0 @@
|
|||
# Tests don't need to go into toplevel/bin, they are fine in the current dir.
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
set(kwalletwizardtest_SRCS
|
||||
kwalletwizardtest.cpp
|
||||
../kwalletwizard.cpp
|
||||
../kbetterthankdialogbase.ui
|
||||
../kwalletwizardpageexplanation.ui
|
||||
../kwalletwizardpageintro.ui
|
||||
../kwalletwizardpageoptions.ui
|
||||
../kwalletwizardpagepassword.ui
|
||||
)
|
||||
|
||||
kde4_add_manual_test(kwalletwizardtest ${kwalletwizardtest_SRCS})
|
||||
target_link_libraries(kwalletwizardtest ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY})
|
||||
|
||||
include_directories( ${KDE4_KDEUI_INCLUDES} ) # for kwallet.h
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwalletasync_SRCS kwalletasync.cpp kwallettest.cpp )
|
||||
|
||||
|
||||
kde4_add_manual_test(kwalletasync ${kwalletasync_SRCS})
|
||||
|
||||
target_link_libraries(kwalletasync ${KDE4_KDEUI_LIBS} )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwalletsync_SRCS kwalletsync.cpp )
|
||||
|
||||
|
||||
kde4_add_manual_test(kwalletsync ${kwalletsync_SRCS})
|
||||
|
||||
target_link_libraries(kwalletsync ${KDE4_KDEUI_LIBS} )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwalletpath_SRCS kwalletpath.cpp )
|
||||
|
||||
|
||||
kde4_add_manual_test(kwalletpath ${kwalletpath_SRCS})
|
||||
|
||||
target_link_libraries(kwalletpath ${KDE4_KDEUI_LIBS} )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwalletboth_SRCS kwalletboth.cpp kwallettest.cpp )
|
||||
|
||||
|
||||
kde4_add_manual_test(kwalletboth ${kwalletboth_SRCS})
|
||||
|
||||
target_link_libraries(kwalletboth ${KDE4_KDEUI_LIBS} )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwalletmany_SRCS kwalletmany.cpp)
|
||||
|
||||
|
||||
kde4_add_manual_test(kwalletmany ${kwalletmany_SRCS})
|
||||
|
||||
target_link_libraries(kwalletmany ${KDE4_KDEUI_LIBS} )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwalletautoclose_SRCS kwalletautoclose.cpp)
|
||||
|
||||
|
||||
kde4_add_manual_test(kwalletautoclose ${kwalletautoclose_SRCS})
|
||||
|
||||
target_link_libraries(kwalletautoclose ${KDE4_KDEUI_LIBS} )
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kwalletnoautoclose_SRCS kwalletnoautoclose.cpp)
|
||||
|
||||
|
||||
kde4_add_manual_test(kwalletnoautoclose ${kwalletnoautoclose_SRCS})
|
||||
|
||||
target_link_libraries(kwalletnoautoclose ${KDE4_KDEUI_LIBS} )
|
||||
|
||||
|
||||
########### install files ###############
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
Tests for opening the wallet synchronously and asynchronously
|
||||
|
||||
kwalletsync - open synchronously
|
||||
kwalletasync - open asynchronously
|
||||
kwalletboth - start opening asynchronously, then, during the async call, open synchronously
|
|
@ -1,70 +0,0 @@
|
|||
#include <QtCore/QTextStream>
|
||||
#include <QApplication>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kwallet.h>
|
||||
#include <QtDBus/QDBusConnectionInterface>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusReply>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "kwallettest.h"
|
||||
|
||||
static QTextStream _out( stdout, QIODevice::WriteOnly );
|
||||
|
||||
void openWallet()
|
||||
{
|
||||
_out << "About to ask for wallet async" << endl;
|
||||
|
||||
// we have no wallet: ask for one.
|
||||
KWallet::Wallet *wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Asynchronous );
|
||||
|
||||
WalletReceiver r;
|
||||
r.connect( wallet, SIGNAL( walletOpened(bool) ), SLOT( walletOpened(bool) ) );
|
||||
|
||||
_out << "About to start 30 second event loop" << endl;
|
||||
|
||||
QTimer::singleShot( 30000, qApp, SLOT( quit() ) );
|
||||
int ret = qApp->exec();
|
||||
|
||||
if ( ret == 0 ) {
|
||||
_out << "Timed out!" << endl;
|
||||
} else {
|
||||
_out << "Success!" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void WalletReceiver::walletOpened( bool got )
|
||||
{
|
||||
_out << "Got async wallet: " << got << endl;
|
||||
qApp->exit( 1 );
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
KAboutData aboutData("kwalletasync", 0, ki18n("kwalletasync"), "version");
|
||||
KComponentData componentData(&aboutData);
|
||||
QApplication app( argc, argv );
|
||||
|
||||
// force name with D-BUS
|
||||
QDBusReply<QDBusConnectionInterface::RegisterServiceReply> reply
|
||||
= QDBusConnection::sessionBus().interface()->registerService( "org.kde.kwalletasync",
|
||||
QDBusConnectionInterface::ReplaceExistingService );
|
||||
|
||||
if ( !reply.isValid() ) {
|
||||
_out << "D-BUS name request returned " << reply.error().name() << endl;
|
||||
}
|
||||
|
||||
openWallet();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// vim: set noet ts=4 sts=4 sw=4:
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <QTextStream>
|
||||
#include <KAboutData>
|
||||
#include <KApplication>
|
||||
#include <KCmdLineArgs>
|
||||
#include <QTimer>
|
||||
#include <KWallet/Wallet>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "kwalletautoclose.h"
|
||||
|
||||
using namespace KWallet;
|
||||
|
||||
static QTextStream _out(stdout, QIODevice::WriteOnly);
|
||||
|
||||
KWalletAutoClose::KWalletAutoClose() : QObject()
|
||||
{
|
||||
}
|
||||
|
||||
void KWalletAutoClose::openWallet()
|
||||
{
|
||||
_out << "Opening wallet synchronously" << endl;
|
||||
Wallet *wallet = Wallet::openWallet(Wallet::NetworkWallet(), 0, Wallet::Synchronous);
|
||||
_out << "Exiting without closing. The wallet should autoclose." << endl;
|
||||
Q_UNUSED(wallet);
|
||||
kapp->exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KAboutData aboutData("kwalletmany", 0, ki18n("kwalletmany"), "version");
|
||||
KCmdLineArgs::init(argc, argv, &aboutData);
|
||||
KApplication app;
|
||||
KWalletAutoClose m;
|
||||
|
||||
QTimer::singleShot(0, &m, SLOT(openWallet()));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
#include "moc_kwalletautoclose.cpp"
|
|
@ -1,40 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef KWALLETAUTOCLOSE_H
|
||||
#define KWALLETAUTOCLOSE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class KWalletAutoClose : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KWalletAutoClose();
|
||||
|
||||
public Q_SLOTS:
|
||||
void openWallet();
|
||||
};
|
||||
|
||||
#endif // KWALLETAUTOCLOSE_H
|
|
@ -1,92 +0,0 @@
|
|||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QMap>
|
||||
#include <QApplication>
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kwallet.h>
|
||||
#include <QtDBus/QDBusConnectionInterface>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusReply>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "kwallettest.h"
|
||||
|
||||
static QTextStream _out( stdout, QIODevice::WriteOnly );
|
||||
|
||||
void openWallet()
|
||||
{
|
||||
_out << "About to ask for wallet async" << endl;
|
||||
|
||||
// we have no wallet: ask for one.
|
||||
KWallet::Wallet *wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Asynchronous );
|
||||
|
||||
WalletReceiver r;
|
||||
r.connect( wallet, SIGNAL( walletOpened(bool) ), SLOT( walletOpened(bool) ) );
|
||||
|
||||
_out << "About to ask for wallet sync" << endl;
|
||||
|
||||
wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Synchronous );
|
||||
|
||||
_out << "Got sync wallet: " << (wallet != 0) << endl;
|
||||
_out << "About to start 30 second event loop" << endl;
|
||||
|
||||
QTimer::singleShot( 30000, qApp, SLOT( quit() ) );
|
||||
int ret = qApp->exec();
|
||||
|
||||
if ( ret == 0 ) {
|
||||
_out << "Timed out!" << endl;
|
||||
} else {
|
||||
_out << "Success!" << endl;
|
||||
}
|
||||
|
||||
QMap<QString,QString> p;
|
||||
ret = wallet->readPasswordList("*", p);
|
||||
_out << "readPasswordList returned: " << ret << endl;
|
||||
_out << "readPasswordList returned " << p.keys().count() << " entries" << endl;
|
||||
QMap<QString, QMap<QString, QString> > q;
|
||||
ret = wallet->readMapList("*", q);
|
||||
_out << "readMapList returned: " << ret << endl;
|
||||
_out << "readMapList returned " << q.keys().count() << " entries" << endl;
|
||||
|
||||
QMap<QString, QByteArray> s;
|
||||
ret = wallet->readEntryList("*", s);
|
||||
_out << "readEntryList returned: " << ret << endl;
|
||||
_out << "readEntryList returned " << s.keys().count() << " entries" << endl;
|
||||
|
||||
delete wallet;
|
||||
}
|
||||
|
||||
void WalletReceiver::walletOpened( bool got )
|
||||
{
|
||||
_out << "Got async wallet: " << got << endl;
|
||||
qApp->exit( 1 );
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
KAboutData aboutData("kwalletboth", 0, ki18n("kwalletboth"), "version");
|
||||
KComponentData componentData(&aboutData);
|
||||
QApplication app( argc, argv );
|
||||
|
||||
// force name with D-BUS
|
||||
QDBusReply<QDBusConnectionInterface::RegisterServiceReply> reply
|
||||
= QDBusConnection::sessionBus().interface()->registerService( "org.kde.kwalletboth",
|
||||
QDBusConnectionInterface::ReplaceExistingService );
|
||||
|
||||
if ( !reply.isValid() ) {
|
||||
_out << "D-BUS name request returned " << reply.error().name() << endl;
|
||||
}
|
||||
|
||||
openWallet();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// vim: set noet ts=4 sts=4 sw=4:
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <QTextStream>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <KAboutData>
|
||||
#include <KApplication>
|
||||
#include <KCmdLineArgs>
|
||||
#include <KWallet/Wallet>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "kwalletmany.h"
|
||||
|
||||
#define NUMWALLETS 10
|
||||
|
||||
using namespace KWallet;
|
||||
|
||||
static QTextStream _out(stdout, QIODevice::WriteOnly);
|
||||
|
||||
KWalletMany::KWalletMany() : QObject(), _pending(10)
|
||||
{
|
||||
}
|
||||
|
||||
KWalletMany::~KWalletMany()
|
||||
{
|
||||
}
|
||||
|
||||
void KWalletMany::walletOpened(bool open)
|
||||
{
|
||||
_out << "Got async wallet: " << (open) << endl;
|
||||
--_pending;
|
||||
if (_pending == 0) {
|
||||
quit();
|
||||
}
|
||||
}
|
||||
|
||||
void KWalletMany::quit()
|
||||
{
|
||||
if (_pending == 0) {
|
||||
_out << "Success!" << endl;
|
||||
} else {
|
||||
_out << "Failed: " << _pending << " requests were not handled!" << endl;
|
||||
}
|
||||
_loop.quit();
|
||||
}
|
||||
|
||||
void KWalletMany::openWallet()
|
||||
{
|
||||
QEventLoop waitLoop;
|
||||
|
||||
// open plenty of wallets in synchronous and asynchronous mode
|
||||
for (int i = 0; i < NUMWALLETS; ++i) {
|
||||
// request asynchronous wallet
|
||||
_out << "About to ask for wallet async" << endl;
|
||||
Wallet *wallet;
|
||||
wallet = Wallet::openWallet(Wallet::NetworkWallet(), 0, Wallet::Asynchronous);
|
||||
connect(wallet, SIGNAL(walletOpened(bool)), SLOT(walletOpened(bool)));
|
||||
_wallets.append(wallet);
|
||||
|
||||
QTimer::singleShot(500, &waitLoop, SLOT(quit()));
|
||||
waitLoop.exec();
|
||||
}
|
||||
|
||||
_loop.exec();
|
||||
while (!_wallets.isEmpty()) {
|
||||
delete _wallets.takeFirst();
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KAboutData aboutData("kwalletmany", 0, ki18n("kwalletmany"), "version");
|
||||
KCmdLineArgs::init(argc, argv, &aboutData);
|
||||
KApplication app;
|
||||
KWalletMany m;
|
||||
|
||||
QTimer::singleShot(0, &m, SLOT(openWallet()));
|
||||
QTimer::singleShot(30000, &m, SLOT(quit()));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
#include "moc_kwalletmany.cpp"
|
|
@ -1,53 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef KWALLETMANY_H
|
||||
#define KWALLETMANY_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QEventLoop>
|
||||
#include <QWaitCondition>
|
||||
|
||||
namespace KWallet { class Wallet; }
|
||||
|
||||
class KWalletMany : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KWalletMany();
|
||||
~KWalletMany();
|
||||
|
||||
public slots:
|
||||
void openWallet();
|
||||
void quit();
|
||||
void walletOpened(bool open);
|
||||
|
||||
private:
|
||||
QList<KWallet::Wallet*> _wallets;
|
||||
int _pending;
|
||||
QEventLoop _loop;
|
||||
};
|
||||
|
||||
#endif // KWALLETMANY_H
|
|
@ -1,107 +0,0 @@
|
|||
// -*- indent-tabs-mode: t; tab-width: 4; c-basic-offset: 4; -*-
|
||||
/*
|
||||
This file is part of the KDE libraries
|
||||
|
||||
Copyright (c) 2008 Michael Leupold <lemma@confuego.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <QTextStream>
|
||||
#include <KAboutData>
|
||||
#include <KApplication>
|
||||
#include <KCmdLineArgs>
|
||||
#include <QEventLoop>
|
||||
#include <QtDBus>
|
||||
#include <klocale.h>
|
||||
|
||||
static QTextStream _out(stdout, QIODevice::WriteOnly);
|
||||
static QString _kdewallet;
|
||||
|
||||
int openAndClose()
|
||||
{
|
||||
QDBusInterface service("org.kde.kwalletd", "/modules/kwalletd");
|
||||
if (!service.isValid()) {
|
||||
_out << "Constructed service is invalid!" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
QDBusReply<int> h = service.call(QDBus::Block, "open", _kdewallet, (qlonglong)0, "kwalletnoautoclose");
|
||||
if (!h.isValid() || h.value() < 0) {
|
||||
_out << "Opening the wallet failed!" << endl;
|
||||
_out << "Error: " << h.error().message() << endl;
|
||||
return 1;
|
||||
} else {
|
||||
_out << "Wallet opened." << endl;
|
||||
}
|
||||
|
||||
_out << "closing the wallet" << endl;
|
||||
QDBusReply<int> r = service.call(QDBus::Block, "close", h.value(), false, "kwalletnoautoclose");
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KAboutData aboutData("kwalletnoautoclose", 0, ki18n("kwalletnoautoclose"), "version");
|
||||
KCmdLineArgs::init(argc, argv, &aboutData);
|
||||
KApplication app;
|
||||
|
||||
QDBusInterface service("org.kde.kwalletd", "/modules/kwalletd");
|
||||
if (!service.isValid()) {
|
||||
_out << "Constructed service is invalid!" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
QDBusReply<bool> r = service.call(QDBus::Block, "isEnabled");
|
||||
if (!r.isValid() || !r) {
|
||||
_out << "kwalletd is disabled or not running!" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
QDBusReply<QString> kdewallet = service.call(QDBus::Block, "localWallet");
|
||||
_kdewallet = kdewallet;
|
||||
_out << "local wallet is " << _kdewallet << endl;
|
||||
|
||||
QDBusReply<bool> open = service.call(QDBus::Block, "isOpen", _kdewallet);
|
||||
if (open) {
|
||||
_out << "wallet is already open. Please close to run this test." << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int rc;
|
||||
|
||||
_out << "Opening and closing the wallet properly." << endl;
|
||||
rc = openAndClose();
|
||||
if (rc != 0) {
|
||||
_out << "FAILED!" << endl;
|
||||
return rc;
|
||||
}
|
||||
|
||||
_out << "Opening and exiting." << endl;
|
||||
QDBusReply<int> h = service.call(QDBus::Block, "open", _kdewallet, (qlonglong)0, "kwalletnoautoclose");
|
||||
if (h < 0) {
|
||||
_out << "Opening the wallet failed!" << endl;
|
||||
return 1;
|
||||
} else {
|
||||
_out << "Wallet opened." << endl;
|
||||
}
|
||||
|
||||
_out << "Exiting. Wallet should stay open." << endl;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kapplication.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kwallet.h>
|
||||
#include <QtDBus/QDBusConnectionInterface>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusReply>
|
||||
#include <klocale.h>
|
||||
|
||||
static QTextStream _out(stdout, QIODevice::WriteOnly);
|
||||
|
||||
void openWallet()
|
||||
{
|
||||
_out << "About to ask for wallet /tmp/test.kwl sync" << endl;
|
||||
|
||||
KWallet::Wallet *wallet = KWallet::Wallet::openWallet("/tmp/test.kwl", 0, KWallet::Wallet::Path);
|
||||
|
||||
_out << "Got path wallet: " << (wallet != 0) << endl;
|
||||
|
||||
if (wallet) {
|
||||
_out << "Closing wallet" << endl;
|
||||
delete wallet;
|
||||
}
|
||||
|
||||
kapp->exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
KAboutData aboutData("kwalletpath", 0, ki18n("kwalletpath"), "version");
|
||||
KCmdLineArgs::init(argc, argv, &aboutData);
|
||||
KApplication app;
|
||||
|
||||
openWallet();
|
||||
|
||||
exit(0);
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
#include <QtCore/QTextStream>
|
||||
#include <QApplication>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kwallet.h>
|
||||
#include <QtDBus/QDBusConnectionInterface>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusReply>
|
||||
#include <klocale.h>
|
||||
|
||||
static QTextStream _out( stdout, QIODevice::WriteOnly );
|
||||
|
||||
void openWallet()
|
||||
{
|
||||
_out << "About to ask for wallet sync" << endl;
|
||||
|
||||
KWallet::Wallet *w = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), 0, KWallet::Wallet::Synchronous );
|
||||
|
||||
_out << "Got sync wallet: " << (w != 0) << endl;
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
KAboutData aboutData("kwalletsync", 0, ki18n("kwalletsync"), "version");
|
||||
KComponentData componentData(&aboutData);
|
||||
QApplication app( argc, argv );
|
||||
|
||||
// force name with D-BUS
|
||||
QDBusReply<QDBusConnectionInterface::RegisterServiceReply> reply
|
||||
= QDBusConnection::sessionBus().interface()->registerService( "org.kde.kwalletsync",
|
||||
QDBusConnectionInterface::ReplaceExistingService );
|
||||
|
||||
if ( !reply.isValid() ) {
|
||||
_out << "D-BUS name request returned " << reply.error().name() << endl;
|
||||
}
|
||||
|
||||
openWallet();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// vim: set noet ts=4 sts=4 sw=4:
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#include "kwallettest.h"
|
||||
#include "moc_kwallettest.cpp"
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef KWALLETASYNC_H
|
||||
#define KWALLETASYNC_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
namespace KWallet { class Wallet; }
|
||||
|
||||
class WalletReceiver : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public Q_SLOTS:
|
||||
void walletOpened( bool );
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2007 Pino Toscano <pino@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "kwalletwizard.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
KWalletWizard wizard;
|
||||
wizard.show();
|
||||
|
||||
int ret = app.exec();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
project(kwallet)
|
||||
|
||||
add_subdirectory( icons )
|
||||
add_subdirectory( src )
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install(
|
||||
PROGRAMS
|
||||
kwalletmanager.desktop
|
||||
kwalletmanager-kwalletd.desktop
|
||||
DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR}
|
||||
)
|
|
@ -1,346 +0,0 @@
|
|||
NOTE! The GPL below is copyrighted by the Free Software Foundation, but
|
||||
the instance of code that it refers to (the kde programs) are copyrighted
|
||||
by the authors who actually wrote it.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
|
@ -1,510 +0,0 @@
|
|||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes a de-facto standard. To achieve this, non-free programs must
|
||||
be allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least
|
||||
three years, to give the same user the materials specified in
|
||||
Subsection 6a, above, for a charge no more than the cost of
|
||||
performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
Things left:
|
||||
|
||||
Backend:
|
||||
- test zSeries
|
||||
- refactor the hashes to make it efficient
|
||||
|
||||
Integration:
|
||||
- Cookie jar
|
||||
|
||||
Future ideas:
|
||||
- Make it a kpart
|
||||
|
||||
GPG
|
||||
- Provide a backend conversion tool to help switching from blowfish to GPG or viceversa
|
|
@ -1 +0,0 @@
|
|||
kde4_install_icons( ${KDE4_DATA_INSTALL_DIR}/kwalletmanager/icons )
|
Binary file not shown.
Before Width: | Height: | Size: 998 B |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
|
@ -1,78 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=Wallet Management Tool
|
||||
Name[ar]=أداة إدارة المحفظة
|
||||
Name[ast]=Ferramienta pa xestionar cartera
|
||||
Name[bg]=Инструмент за настройване на "Портфейл"
|
||||
Name[br]=Merour an doug-paperoù
|
||||
Name[bs]=Alatka za upravljanje novčanicima
|
||||
Name[ca]=Eina de gestió de carteres
|
||||
Name[ca@valencia]=Eina de gestió de carteres
|
||||
Name[cs]=Nástroj pro správu úschovny
|
||||
Name[cy]=Erfyn Rheoli Waled
|
||||
Name[da]=Håndteringsværktøj for tegnebog
|
||||
Name[de]=Passwortverwaltung
|
||||
Name[el]=Εργαλείο διαχείρισης πορτοφολιού
|
||||
Name[en_GB]=Wallet Management Tool
|
||||
Name[eo]=Paperuja administrilo
|
||||
Name[es]=Herramienta de gestión de cartera
|
||||
Name[et]=Turvalaeka haldur
|
||||
Name[eu]=Zorroa kudeatzeko tresna
|
||||
Name[fa]=ابزار مدیریت Wallet
|
||||
Name[fi]=Lompakonhallinta
|
||||
Name[fr]=Outil de gestion de portefeuilles
|
||||
Name[ga]=Uirlis Bhainisteoireachta Wallet
|
||||
Name[gl]=Utilidade de xestión de carteiras
|
||||
Name[he]=כלי לניהול הארנק של KDE
|
||||
Name[hne]=बटुआ प्रबंधन औजार
|
||||
Name[hr]=Alat za upravljanje novčanikom
|
||||
Name[hu]=Jelszókezelő eszköz
|
||||
Name[ia]=Instrumento de gestion de portafolio
|
||||
Name[id]=Perkakas Manajemen Dompet
|
||||
Name[is]=Tól til að stýra eiginleikum veskisins
|
||||
Name[it]=Strumento per la gestione dei portafogli
|
||||
Name[ja]=ウォレット管理ツール
|
||||
Name[kk]=Әмиянын басқару құралы
|
||||
Name[km]=ឧបករណ៍គ្រប់គ្រងកាបូប
|
||||
Name[ko]=지갑 관리 도구
|
||||
Name[lt]=Spatažodinių tvarkymo įrankis
|
||||
Name[lv]=Maka pārvaldības rīks
|
||||
Name[mk]=Алатка за менаџирање на паричници
|
||||
Name[mr]=पाकीट व्यवस्थापन साधन
|
||||
Name[nb]=Wallet administrasjonsverktøy
|
||||
Name[nds]=Knippenpleger
|
||||
Name[ne]=वालेट व्यवस्थापन उपकरण
|
||||
Name[nl]=Portefeuillebeheer
|
||||
Name[nn]=Wallet-administrasjonsverktøy
|
||||
Name[pa]=ਵਾਲਿਟ ਪਰਬੰਧਨ ਟੂਲ
|
||||
Name[pl]=Narzędzie do zarządzania portfelem
|
||||
Name[pt]=Ferramenta de Gestão da Carteira
|
||||
Name[pt_BR]=Ferramenta de gerenciamento de carteiras
|
||||
Name[ro]=Administrare portofel
|
||||
Name[ru]=Управление бумажниками
|
||||
Name[sk]=Nástroj pre správu KDE Wallet
|
||||
Name[sl]=Orodje za upravljanje z listnicami
|
||||
Name[sq]=Mjet i Menaxhimit të Portofolit
|
||||
Name[sr]=Алатка за управљање новчаницима
|
||||
Name[sr@ijekavian]=Алатка за управљање новчаницима
|
||||
Name[sr@ijekavianlatin]=Alatka za upravljanje novčanicima
|
||||
Name[sr@latin]=Alatka za upravljanje novčanicima
|
||||
Name[sv]=Hanteringsverktyg för plånbok
|
||||
Name[ta]=வாலட் மேலாண்மை கருவி
|
||||
Name[tg]=Асбоби Идоракунии Ҳамён
|
||||
Name[th]=เครื่องมือจัดการกระเป๋าคุมข้อมูล
|
||||
Name[tr]=Cüzdan Yönetim Aracı
|
||||
Name[ug]=ھەميان باشقۇرۇش قورالى
|
||||
Name[uk]=Засіб керування торбинками
|
||||
Name[uz]=Qopchiq boshqarish vositasi
|
||||
Name[uz@cyrillic]=Қопчиқ бошқариш воситаси
|
||||
Name[vi]=Công Cụ Quản Lý Ví
|
||||
Name[x-test]=xxWallet Management Toolxx
|
||||
Name[zh_CN]=钱包管理工具
|
||||
Name[zh_TW]=錢包管理工具
|
||||
Exec=kwalletmanager --kwalletd
|
||||
Icon=kwalletmanager
|
||||
Type=Application
|
||||
Terminal=false
|
||||
X-KDE-StartupNotify=false
|
||||
NoDisplay=true
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=KWalletManager
|
||||
Name[ar]=KWalletManager
|
||||
Name[ast]=KWalletManager
|
||||
Name[bg]=KWalletManager
|
||||
Name[bs]=KWalletManager
|
||||
Name[ca]=KWalletManager
|
||||
Name[ca@valencia]=KWalletManager
|
||||
Name[cs]=KWalletManager
|
||||
Name[da]=KWalletManager
|
||||
Name[de]=KWalletManager
|
||||
Name[el]=KWalletManager
|
||||
Name[en_GB]=KWalletManager
|
||||
Name[es]=KWalletManager
|
||||
Name[et]=Turvalaeka haldur
|
||||
Name[eu]=KWalletManager
|
||||
Name[fi]=KWalletManager
|
||||
Name[fr]=KWalletManager
|
||||
Name[ga]=KWalletManager
|
||||
Name[gl]=KWalletManager
|
||||
Name[hne]=के-वालेट-मैनेजर
|
||||
Name[hr]=KWalletManager
|
||||
Name[hu]=KWalletManager
|
||||
Name[ia]=Gerente KWallet
|
||||
Name[id]=KWalletManager
|
||||
Name[it]=KWalletManager
|
||||
Name[ja]=KWalletManager
|
||||
Name[kk]=KWalletManager
|
||||
Name[km]=KWalletManager
|
||||
Name[ko]=KWalletManager
|
||||
Name[lt]=KWalletManager
|
||||
Name[lv]=KWalletManager
|
||||
Name[mr]=के-वॉलेट व्यवस्थापक
|
||||
Name[nb]=KWalletManager
|
||||
Name[nds]=KDE-Knippenpleger
|
||||
Name[nl]=KWalletManager
|
||||
Name[nn]=KWalletManager
|
||||
Name[pa]=ਕੇਵਾਲਿਟ-ਮੈਨੇਜਰ
|
||||
Name[pl]=Zarządzanie Portfelem
|
||||
Name[pt]=KWalletManager
|
||||
Name[pt_BR]=KWalletManager
|
||||
Name[ro]=KWalletManager
|
||||
Name[ru]=KWalletManager
|
||||
Name[sk]=KWalletManager
|
||||
Name[sl]=Upravljalnik Listnice za KDE
|
||||
Name[sq]=KWalletManager
|
||||
Name[sr]=Менаџер К‑новчаника
|
||||
Name[sr@ijekavian]=Менаџер К‑новчаника
|
||||
Name[sr@ijekavianlatin]=Menadžer K‑novčanika
|
||||
Name[sr@latin]=Menadžer K‑novčanika
|
||||
Name[sv]=Hanteringsverktyg för plånbok
|
||||
Name[th]=จัดการกระเป๋าคุมข้อมูล-K
|
||||
Name[tr]=KWallet Yönetim Aracı
|
||||
Name[ug]=KWalletManager
|
||||
Name[uk]=KWalletManager
|
||||
Name[x-test]=xxKWalletManagerxx
|
||||
Name[zh_CN]=KWalletManager
|
||||
Name[zh_TW]=KDE 錢包管理員
|
||||
GenericName=Wallet Management Tool
|
||||
GenericName[ar]=أداة إدارة المحفظة
|
||||
GenericName[ast]=Ferramienta pa xestionar cartera
|
||||
GenericName[bg]=Управление на "Портфейл"
|
||||
GenericName[bs]=Alatka za upravljanje novčanicima
|
||||
GenericName[ca]=Eina de gestió de carteres
|
||||
GenericName[ca@valencia]=Eina de gestió de carteres
|
||||
GenericName[cs]=Nástroj pro správu úschovny
|
||||
GenericName[da]=Værktøj til håndtering af tegnebog
|
||||
GenericName[de]=Passwortverwaltung
|
||||
GenericName[el]=Εργαλείο διαχείρισης πορτοφολιού
|
||||
GenericName[en_GB]=Wallet Management Tool
|
||||
GenericName[es]=Herramienta de gestión de carteras
|
||||
GenericName[et]=Turvalaeka haldur
|
||||
GenericName[eu]=Zorroa kudeatzeko tresna
|
||||
GenericName[fi]=Lompakonhallinta
|
||||
GenericName[fr]=Outil de gestion de portefeuilles
|
||||
GenericName[ga]=Uirlis Bhainisteoireachta Sparáin
|
||||
GenericName[gl]=Utilidade de xestión de carteiras
|
||||
GenericName[hne]=बटुआ प्रबंधन औजार
|
||||
GenericName[hr]=Alat za upravljanje novčanikom
|
||||
GenericName[hu]=Jelszókezelő eszköz
|
||||
GenericName[ia]=Instrumento de gestion de portafolio
|
||||
GenericName[id]=Perkakas Manajemen Dompet
|
||||
GenericName[it]=Strumento per la gestione dei portafogli
|
||||
GenericName[ja]=ウォレット管理ツール
|
||||
GenericName[kk]=Әмиянын басқару құралы
|
||||
GenericName[km]=ឧបករណ៍គ្រប់គ្រងកាបូប
|
||||
GenericName[ko]=지갑 관리 도구
|
||||
GenericName[lt]=Spatažodinių tvarkymo įrankis
|
||||
GenericName[lv]=Maka pārvaldības rīks
|
||||
GenericName[mr]=पाकीट व्यवस्थापन साधन
|
||||
GenericName[nb]=Wallet administrasjonsverktøy
|
||||
GenericName[nds]=Knippenpleger
|
||||
GenericName[nl]=Portefeuillebeheer
|
||||
GenericName[nn]=Wallet-administrasjonsverktøy
|
||||
GenericName[pa]=ਵਾਲਿਟ ਪਰਬੰਧਨ ਟੂਲ
|
||||
GenericName[pl]=Narzędzie do zarządzania Portfelem
|
||||
GenericName[pt]=Ferramenta de Gestão da Carteira
|
||||
GenericName[pt_BR]=Ferramenta de gerenciamento de carteiras
|
||||
GenericName[ro]=Administrare portofel
|
||||
GenericName[ru]=Управление бумажниками
|
||||
GenericName[sk]=Nástroj pre správu KDE Wallet
|
||||
GenericName[sl]=Orodje za upravljanje z listnicami
|
||||
GenericName[sq]=Mjet i Menaxhimit të Portofolit
|
||||
GenericName[sr]=Алатка за управљање новчаницима
|
||||
GenericName[sr@ijekavian]=Алатка за управљање новчаницима
|
||||
GenericName[sr@ijekavianlatin]=Alatka za upravljanje novčanicima
|
||||
GenericName[sr@latin]=Alatka za upravljanje novčanicima
|
||||
GenericName[sv]=Hanteringsverktyg för plånbok
|
||||
GenericName[th]=เครื่องมือจัดการกระเป๋าคุมข้อมูล
|
||||
GenericName[tr]=Cüzdan Yönetim Aracı
|
||||
GenericName[ug]=ھەميان باشقۇرۇش قورالى
|
||||
GenericName[uk]=Засіб керування торбинками
|
||||
GenericName[x-test]=xxWallet Management Toolxx
|
||||
GenericName[zh_CN]=钱包管理工具
|
||||
GenericName[zh_TW]=錢包管理工具
|
||||
Exec=kwalletmanager --icon '%i' --caption '%c' %u
|
||||
MimeType=application/x-kwallet;
|
||||
InitialPreference=6
|
||||
Icon=kwalletmanager
|
||||
Type=Application
|
||||
Terminal=false
|
||||
X-KDE-StartupNotify=false
|
||||
Categories=Qt;KDE;System;Security;
|
||||
X-DocPath=kwallet/index.html
|
|
@ -1,2 +0,0 @@
|
|||
add_subdirectory(konfigurator)
|
||||
add_subdirectory(manager)
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
|
||||
|
||||
|
||||
########### next target ###############
|
||||
|
||||
set(kcm_kwallet_PART_SRCS konfigurator.cpp walletconfigwidget.ui)
|
||||
|
||||
kde4_add_plugin(kcm_kwallet ${kcm_kwallet_PART_SRCS})
|
||||
|
||||
|
||||
target_link_libraries(kcm_kwallet ${KDE4_KDEUI_LIBS})
|
||||
|
||||
install(TARGETS kcm_kwallet DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install( FILES kwalletconfig.desktop kwalletmanager_show.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
$EXTRACTRC *.ui >> rc.cpp
|
||||
$XGETTEXT *.cpp -o $podir/kcmkwallet.pot
|
|
@ -1,365 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2003 George Staikos <staikos@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "konfigurator.h"
|
||||
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <kaboutdata.h>
|
||||
#include <kapplication.h>
|
||||
#include <ksharedconfig.h>
|
||||
#include <kdialog.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <kinputdialog.h>
|
||||
#include <kmenu.h>
|
||||
#include <kwallet.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
#include <QtCore/qfile.h>
|
||||
#include <ktoolinvocation.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#define KWALLETMANAGERINTERFACE "org.kde.KWallet"
|
||||
|
||||
K_PLUGIN_FACTORY(KWalletFactory, registerPlugin<KWalletConfig>();)
|
||||
K_EXPORT_PLUGIN(KWalletFactory("kcmkwallet"))
|
||||
|
||||
|
||||
KWalletConfig::KWalletConfig(QWidget *parent, const QVariantList& args)
|
||||
: KCModule(KWalletFactory::componentData(), parent, args),
|
||||
_cfg(KSharedConfig::openConfig(QLatin1String( "kwalletrc" ), KConfig::NoGlobals)) {
|
||||
|
||||
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwallet"), 0,
|
||||
ki18n("KDE Wallet Control Module"),
|
||||
0, KLocalizedString(), KAboutData::License_GPL,
|
||||
ki18n("(c) 2003 George Staikos"));
|
||||
about->addAuthor(ki18n("George Staikos"), KLocalizedString(), "staikos@kde.org");
|
||||
setAboutData( about );
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setSpacing(KDialog::spacingHint());
|
||||
vbox->setMargin(0);
|
||||
_wcw = new WalletConfigWidget(this);
|
||||
vbox->addWidget(_wcw);
|
||||
|
||||
connect(_wcw->_enabled, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_launchManager, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_autocloseManager, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_autoclose, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_closeIdle, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_openPrompt, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_screensaverLock, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_localWalletSelected, SIGNAL(clicked()), this, SLOT(configChanged()));
|
||||
connect(_wcw->_idleTime, SIGNAL(valueChanged(int)), this, SLOT(configChanged()));
|
||||
connect(_wcw->_launch, SIGNAL(clicked()), this, SLOT(launchManager()));
|
||||
connect(_wcw->_newWallet, SIGNAL(clicked()), this, SLOT(newNetworkWallet()));
|
||||
connect(_wcw->_newLocalWallet, SIGNAL(clicked()), this, SLOT(newLocalWallet()));
|
||||
connect(_wcw->_localWallet, SIGNAL(activated(int)), this, SLOT(configChanged()));
|
||||
connect(_wcw->_defaultWallet, SIGNAL(activated(int)), this, SLOT(configChanged()));
|
||||
connect(_wcw->_accessList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
|
||||
|
||||
_wcw->_accessList->setAllColumnsShowFocus(true);
|
||||
_wcw->_accessList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
updateWalletLists();
|
||||
|
||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String( "org.kde.kwalletmanager" ))) {
|
||||
_wcw->_launch->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
KWalletConfig::~KWalletConfig() {
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::updateWalletLists() {
|
||||
const QString p1( _wcw->_localWallet->currentText() );
|
||||
const QString p2( _wcw->_defaultWallet->currentText() );
|
||||
|
||||
_wcw->_localWallet->clear();
|
||||
_wcw->_defaultWallet->clear();
|
||||
|
||||
const QStringList wl = KWallet::Wallet::walletList();
|
||||
_wcw->_localWallet->addItems(wl);
|
||||
_wcw->_defaultWallet->addItems(wl);
|
||||
|
||||
int index = wl.indexOf(p1);
|
||||
if (index != -1) {
|
||||
_wcw->_localWallet->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
index = wl.indexOf(p2);
|
||||
if (index != -1) {
|
||||
_wcw->_defaultWallet->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString KWalletConfig::newWallet() {
|
||||
bool ok;
|
||||
|
||||
const QString n = KInputDialog::getText(i18n("New Wallet"),
|
||||
i18n("Please choose a name for the new wallet:"),
|
||||
QString(),
|
||||
&ok,
|
||||
this);
|
||||
|
||||
if (!ok) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
KWallet::Wallet *w = KWallet::Wallet::openWallet(n, window()->winId());
|
||||
if (!w) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
delete w;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::newLocalWallet() {
|
||||
const QString n = newWallet();
|
||||
if (n.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateWalletLists();
|
||||
|
||||
_wcw->_localWallet->setCurrentIndex(_wcw->_localWallet->findText(n));
|
||||
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::newNetworkWallet() {
|
||||
const QString n = newWallet();
|
||||
if (n.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateWalletLists();
|
||||
|
||||
_wcw->_defaultWallet->setCurrentIndex(_wcw->_defaultWallet->findText(n));
|
||||
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::launchManager() {
|
||||
if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String( "org.kde.kwalletmanager" ))) {
|
||||
KToolInvocation::startServiceByDesktopName( QLatin1String( "kwalletmanager_show" ));
|
||||
} else {
|
||||
QDBusInterface kwalletd(QLatin1String( "org.kde.kwalletmanager" ), QLatin1String( "/kwalletmanager/MainWindow_1" ));
|
||||
kwalletd.call( QLatin1String( "show" ));
|
||||
kwalletd.call( QLatin1String( "raise" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::configChanged() {
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
void KWalletConfig::load() {
|
||||
KConfigGroup config(_cfg, "Wallet");
|
||||
_wcw->_enabled->setChecked(config.readEntry("Enabled", true));
|
||||
_wcw->_openPrompt->setChecked(config.readEntry("Prompt on Open", false));
|
||||
_wcw->_launchManager->setChecked(config.readEntry("Launch Manager", false));
|
||||
_wcw->_autocloseManager->setChecked(! config.readEntry("Leave Manager Open", false));
|
||||
_wcw->_screensaverLock->setChecked(config.readEntry("Close on Screensaver", false));
|
||||
_wcw->_autoclose->setChecked(!config.readEntry("Leave Open", false));
|
||||
_wcw->_closeIdle->setChecked(config.readEntry("Close When Idle", false));
|
||||
_wcw->_idleTime->setValue(config.readEntry("Idle Timeout", 10));
|
||||
if (config.hasKey("Default Wallet")) {
|
||||
int defaultWallet_idx = _wcw->_defaultWallet->findText(config.readEntry("Default Wallet"));
|
||||
if (defaultWallet_idx != -1) {
|
||||
_wcw->_defaultWallet->setCurrentIndex(defaultWallet_idx);
|
||||
} else {
|
||||
_wcw->_defaultWallet->setCurrentIndex(0);
|
||||
}
|
||||
} else {
|
||||
_wcw->_defaultWallet->setCurrentIndex(0);
|
||||
}
|
||||
if (config.hasKey("Local Wallet")) {
|
||||
_wcw->_localWalletSelected->setChecked( !config.readEntry("Use One Wallet", false) );
|
||||
int localWallet_idx = _wcw->_localWallet->findText(config.readEntry("Local Wallet"));
|
||||
if (localWallet_idx != -1) {
|
||||
_wcw->_localWallet->setCurrentIndex(localWallet_idx);
|
||||
} else {
|
||||
_wcw->_localWallet->setCurrentIndex(0);
|
||||
}
|
||||
} else {
|
||||
_wcw->_localWalletSelected->setChecked(false);
|
||||
}
|
||||
_wcw->_accessList->clear();
|
||||
KConfigGroup ad(_cfg, "Auto Deny");
|
||||
KConfigGroup aa(_cfg, "Auto Allow");
|
||||
QStringList denykeys = ad.entryMap().keys();
|
||||
const QStringList keys = aa.entryMap().keys();
|
||||
for (QStringList::const_iterator i = keys.begin(); i != keys.end(); ++i) {
|
||||
QString walletName = *i;
|
||||
// perform cleanup in the kwalletrc file, by removing entries that correspond to non-existent
|
||||
// (previously deleted, for example) wallets
|
||||
QString path = KGlobal::dirs()->locateLocal("data", QString("kwallet/%1.kwl").arg(walletName));
|
||||
if (!QFile::exists(path)) {
|
||||
// if the wallet no longer exists, delete the entries from the configuration file and skip to next entry
|
||||
KConfigGroup cfgAllow = KSharedConfig::openConfig("kwalletrc")->group("Auto Allow");
|
||||
cfgAllow.deleteEntry(walletName);
|
||||
|
||||
KConfigGroup cfgDeny = KSharedConfig::openConfig("kwalletrc")->group("Auto Deny");
|
||||
cfgDeny.deleteEntry(walletName);
|
||||
continue;
|
||||
}
|
||||
|
||||
const QStringList apps = aa.readEntry(*i,QStringList());
|
||||
const QStringList denyapps = ad.readEntry(*i, QStringList());
|
||||
denykeys.removeAll(walletName);
|
||||
QTreeWidgetItem *twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << walletName);
|
||||
for (QStringList::const_iterator j = apps.begin(); j != apps.end(); ++j) {
|
||||
new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Allow"));
|
||||
}
|
||||
for (QStringList::const_iterator j = denyapps.begin(); j != denyapps.end(); ++j) {
|
||||
new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Deny"));
|
||||
}
|
||||
}
|
||||
for (QStringList::const_iterator i = denykeys.constBegin(); i != denykeys.constEnd(); ++i) {
|
||||
const QStringList denyapps = ad.readEntry(*i,QStringList());
|
||||
QTreeWidgetItem *twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << *i);
|
||||
for (QStringList::const_iterator j = denyapps.begin(); j != denyapps.end(); ++j) {
|
||||
new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Deny"));
|
||||
}
|
||||
}
|
||||
_wcw->_accessList->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::save() {
|
||||
KConfigGroup config(_cfg, "Wallet");
|
||||
config.writeEntry("Enabled", _wcw->_enabled->isChecked());
|
||||
config.writeEntry("Launch Manager", _wcw->_launchManager->isChecked());
|
||||
config.writeEntry("Leave Manager Open", !_wcw->_autocloseManager->isChecked());
|
||||
config.writeEntry("Leave Open", !_wcw->_autoclose->isChecked());
|
||||
config.writeEntry("Close When Idle", _wcw->_closeIdle->isChecked());
|
||||
config.writeEntry("Idle Timeout", _wcw->_idleTime->value());
|
||||
config.writeEntry("Prompt on Open", _wcw->_openPrompt->isChecked());
|
||||
config.writeEntry("Close on Screensaver", _wcw->_screensaverLock->isChecked());
|
||||
|
||||
config.writeEntry("Use One Wallet", !_wcw->_localWalletSelected->isChecked());
|
||||
if (_wcw->_localWalletSelected->isChecked()) {
|
||||
config.writeEntry("Local Wallet", _wcw->_localWallet->currentText());
|
||||
} else {
|
||||
config.deleteEntry("Local Wallet");
|
||||
}
|
||||
|
||||
if (_wcw->_defaultWallet->currentIndex() != -1) {
|
||||
config.writeEntry("Default Wallet", _wcw->_defaultWallet->currentText());
|
||||
} else {
|
||||
config.deleteEntry("Default Wallet");
|
||||
}
|
||||
|
||||
// FIXME: won't survive a language change
|
||||
_cfg->deleteGroup("Auto Allow");
|
||||
_cfg->deleteGroup("Auto Deny");
|
||||
config = _cfg->group("Auto Allow");
|
||||
for (int i = 0; i < _wcw->_accessList->topLevelItemCount(); ++i) {
|
||||
QTreeWidgetItem *parentItem = _wcw->_accessList->topLevelItem(i);
|
||||
QStringList al;
|
||||
for (int j = 0; j < parentItem->childCount(); ++j) {
|
||||
QTreeWidgetItem *childItem = parentItem->child(j);
|
||||
if (childItem->text(2) == i18n("Always Allow")) {
|
||||
al << childItem->text(1);
|
||||
}
|
||||
}
|
||||
config.writeEntry(parentItem->text(0), al);
|
||||
}
|
||||
|
||||
config = _cfg->group("Auto Deny");
|
||||
for (int i = 0; i < _wcw->_accessList->topLevelItemCount(); ++i) {
|
||||
QTreeWidgetItem *parentItem = _wcw->_accessList->topLevelItem(i);
|
||||
QStringList al;
|
||||
for (int j = 0; j < parentItem->childCount(); ++j) {
|
||||
QTreeWidgetItem *childItem = parentItem->child(j);
|
||||
if (childItem->text(2) == i18n("Always Deny")) {
|
||||
al << childItem->text(1);
|
||||
}
|
||||
}
|
||||
config.writeEntry(parentItem->text(0), al);
|
||||
}
|
||||
|
||||
_cfg->sync();
|
||||
|
||||
// this restarts kwalletd if necessary
|
||||
if (KWallet::Wallet::isEnabled()) {
|
||||
QDBusInterface kwalletd(QLatin1String( "org.kde.kwalletd" ), QLatin1String( "/modules/kwalletd" ),QLatin1String( KWALLETMANAGERINTERFACE ));
|
||||
kwalletd.call( QLatin1String( "reconfigure" ) );
|
||||
}
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::defaults() {
|
||||
_wcw->_enabled->setChecked(true);
|
||||
_wcw->_openPrompt->setChecked(false);
|
||||
_wcw->_launchManager->setChecked(false);
|
||||
_wcw->_autocloseManager->setChecked(false);
|
||||
_wcw->_screensaverLock->setChecked(false);
|
||||
_wcw->_autoclose->setChecked(false);
|
||||
_wcw->_closeIdle->setChecked(false);
|
||||
_wcw->_idleTime->setValue(10);
|
||||
_wcw->_defaultWallet->setCurrentIndex(0);
|
||||
_wcw->_localWalletSelected->setChecked(false);
|
||||
_wcw->_localWallet->setCurrentIndex( 0 );
|
||||
_wcw->_accessList->clear();
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
|
||||
QString KWalletConfig::quickHelp() const {
|
||||
return i18n("This configuration module allows you to configure the KDE wallet system.");
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::customContextMenuRequested(const QPoint& pos) {
|
||||
QTreeWidgetItem *item = _wcw->_accessList->itemAt(pos);
|
||||
if (item && item->parent()) {
|
||||
KMenu *m = new KMenu(this);
|
||||
m->addTitle(item->parent()->text(0));
|
||||
m->addAction( i18n("&Delete" ), this, SLOT(deleteEntry()), Qt::Key_Delete);
|
||||
m->exec(_wcw->_accessList->mapToGlobal(pos));
|
||||
delete m;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KWalletConfig::deleteEntry() {
|
||||
QList<QTreeWidgetItem*> items = _wcw->_accessList->selectedItems();
|
||||
if (items.count() == 1 && items[0] ) {
|
||||
delete items[0];
|
||||
emit changed(true);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_konfigurator.cpp"
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2003 George Staikos <staikos@kde.org>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KWALLETKONFIGURATOR_H
|
||||
#define KWALLETKONFIGURATOR_H
|
||||
#include <kcmodule.h>
|
||||
#include <ksharedconfig.h>
|
||||
#include "ui_walletconfigwidget.h"
|
||||
|
||||
class WalletConfigWidget : public QWidget, public Ui::WalletConfigWidget
|
||||
{
|
||||
public:
|
||||
WalletConfigWidget( QWidget *parent ) : QWidget( parent ) {
|
||||
setupUi( this );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class KWalletConfig : public KCModule {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KWalletConfig(QWidget *parent = 0L, const QVariantList& = QVariantList());
|
||||
virtual ~KWalletConfig();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
void defaults();
|
||||
|
||||
QString quickHelp() const;
|
||||
|
||||
public slots:
|
||||
void configChanged();
|
||||
void launchManager();
|
||||
void newLocalWallet();
|
||||
void newNetworkWallet();
|
||||
void updateWalletLists();
|
||||
QString newWallet();
|
||||
void deleteEntry();
|
||||
void customContextMenuRequested(const QPoint& pos);
|
||||
|
||||
private:
|
||||
WalletConfigWidget *_wcw;
|
||||
KSharedConfig::Ptr _cfg;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,196 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Icon=kwalletmanager
|
||||
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
|
||||
Exec=kcmshell4 kwalletconfig
|
||||
X-DocPath=kwallet/index.html#kwallet-kcontrol-module
|
||||
X-KDE-Library=kcm_kwallet
|
||||
X-KDE-ParentApp=kcontrol
|
||||
X-KDE-System-Settings-Parent-Category=account-details
|
||||
|
||||
Name=KDE Wallet
|
||||
Name[ar]=محفظة كدى
|
||||
Name[ast]=Cartera KDE
|
||||
Name[bg]=KDE Wallet
|
||||
Name[br]=Doug-paperoù KDE
|
||||
Name[bs]=KDE novčanik
|
||||
Name[ca]=Cartera del KDE
|
||||
Name[ca@valencia]=Cartera del KDE
|
||||
Name[cs]=Úschovna KDE
|
||||
Name[cy]=Waled KDE
|
||||
Name[da]=KDE's tegnebog
|
||||
Name[de]=KDE-Passwortspeicher
|
||||
Name[el]=Πορτοφόλι του KDE
|
||||
Name[en_GB]=KDE Wallet
|
||||
Name[eo]=KDE paperujo
|
||||
Name[es]=Cartera de KDE
|
||||
Name[et]=KDE turvalaegas
|
||||
Name[eu]=KDEren zorroa
|
||||
Name[fi]=KDE-lompakko
|
||||
Name[fr]=Portefeuille de KDE
|
||||
Name[ga]=KDE Wallet
|
||||
Name[gl]=KDE Wallet
|
||||
Name[he]=KDE Wallet
|
||||
Name[hne]=केडीई वालेट
|
||||
Name[hr]=KDE-ov novčanik
|
||||
Name[hu]=KDE Wallet
|
||||
Name[ia]=KDE Wallet (Portafolio de KDE)
|
||||
Name[id]=Dompet KDE
|
||||
Name[is]=KDE veskið
|
||||
Name[it]=Portafogli di KDE
|
||||
Name[ja]=KDE ウォレット
|
||||
Name[kk]=KDE әмияны
|
||||
Name[km]=កាបូបរបស់ KDE
|
||||
Name[ko]=KDE 지갑
|
||||
Name[lt]=KDE slaptažodinės
|
||||
Name[lv]=KDE Maks
|
||||
Name[mk]=KDE Паричник
|
||||
Name[mr]=केडीई पाकीट
|
||||
Name[nb]=KDE Wallet
|
||||
Name[nds]=KDE-Knipp
|
||||
Name[ne]=केडीई वालेट
|
||||
Name[nl]=KDE Portefeuillebeheer
|
||||
Name[nn]=KDE-lommebok
|
||||
Name[pa]=KDE ਵਾਲਿਟ
|
||||
Name[pl]=Portfel KDE
|
||||
Name[pt]=Carteira do KDE
|
||||
Name[pt_BR]=Carteira do KDE
|
||||
Name[ro]=Portofel KDE
|
||||
Name[ru]=Бумажник
|
||||
Name[sk]=KDE Wallet
|
||||
Name[sl]=Listnica KDE
|
||||
Name[sq]=KDE Portofoli
|
||||
Name[sr]=К‑новчаник
|
||||
Name[sr@ijekavian]=К‑новчаник
|
||||
Name[sr@ijekavianlatin]=K‑novčanik
|
||||
Name[sr@latin]=K‑novčanik
|
||||
Name[sv]=KDE-plånbok
|
||||
Name[ta]= கேடிஇ வாலட்
|
||||
Name[tg]=KDE Ҳамён
|
||||
Name[th]=กระเป๋าคุมข้อมูลของ KDE
|
||||
Name[tr]=KDE Cüzdanı
|
||||
Name[ug]=KDE ھەميان
|
||||
Name[uk]=Торбинки KDE
|
||||
Name[uz]=KDE qopchiq
|
||||
Name[uz@cyrillic]=KDE қопчиқ
|
||||
Name[vi]=Ví KDE
|
||||
Name[wa]=Poite-manoye KDE
|
||||
Name[x-test]=xxKDE Walletxx
|
||||
Name[zh_CN]=KDE 钱包
|
||||
Name[zh_TW]=KDE 錢包
|
||||
Comment=KDE Wallet Configuration
|
||||
Comment[ar]=إعداد محفظة كدى
|
||||
Comment[ast]=Configuración de la Cartera KDE
|
||||
Comment[bg]=Настройване на "Портфейл"
|
||||
Comment[br]=Kefluniadur Doug-paperoù KDE
|
||||
Comment[bs]=Podešavanje KDE novčanika
|
||||
Comment[ca]=Configuració de la cartera del KDE
|
||||
Comment[ca@valencia]=Configuració de la cartera del KDE
|
||||
Comment[cs]=Nastavení úschovny KDE
|
||||
Comment[cy]=Ffurfweddiad Waled KDE
|
||||
Comment[da]=Konfiguration af KDE's tegnebog
|
||||
Comment[de]=Einrichten des Passwortspeichers (KWallet)
|
||||
Comment[el]=Διαμόρφωση του πορτοφολιού του KDE
|
||||
Comment[en_GB]=KDE Wallet Configuration
|
||||
Comment[eo]=KDE paperuja agordo
|
||||
Comment[es]=Configuración de la cartera de KDE
|
||||
Comment[et]=KDE turvalaeka seadistamine
|
||||
Comment[eu]=KDEren zorroaren konfigurazioa
|
||||
Comment[fa]=KDE Wallet پیکربندی
|
||||
Comment[fi]=KDE-lompakon asetukset
|
||||
Comment[fr]=Configuration du portefeuille de KDE
|
||||
Comment[ga]=Cumraíocht KDE Wallet
|
||||
Comment[gl]=Configuración da carteira de KDE
|
||||
Comment[he]=KDE Wallet הגדרות
|
||||
Comment[hne]=केडीई वालेट कान्फिगरेसन
|
||||
Comment[hr]=Konfiguracija KDE-ovog novčanika
|
||||
Comment[hu]=KDE jelszókezelő beállítások
|
||||
Comment[ia]=Configuration de portafolio de KDE
|
||||
Comment[id]=Konfigurasi Dompet KDE
|
||||
Comment[is]=Stillingar veskisins
|
||||
Comment[it]=Configurazione portafogli di KDE
|
||||
Comment[ja]=KDE ウォレットの設定
|
||||
Comment[kk]=KDE әмиянның баптауы
|
||||
Comment[km]=កំណត់រចនាសម្ព័ន្ធកាបូបរបស់ KDE
|
||||
Comment[ko]=KDE 지갑 설정
|
||||
Comment[lt]=KDE slaptažodinių konfigūravimas
|
||||
Comment[lv]=KDE Maka konfigurācija
|
||||
Comment[mk]=Конфигурација на паричник во KDE
|
||||
Comment[mr]=केडीई पाकीट संयोजना
|
||||
Comment[nb]=Oppsett av KDE Wallet
|
||||
Comment[nds]=KDE-Knipp instellen
|
||||
Comment[ne]=केडीई वालेट कन्फिगरेसन
|
||||
Comment[nl]=KDE-portefeuille instellen
|
||||
Comment[nn]=Oppsett av KDE-lommeboka
|
||||
Comment[pa]=KDE ਵਾਲਿਟ ਸੰਰਚਨਾ
|
||||
Comment[pl]=Konfiguracja portfela KDE
|
||||
Comment[pt]=Configuração da Carteira do KDE
|
||||
Comment[pt_BR]=Configuração da carteira do KDE
|
||||
Comment[ro]=Configurează portofelul KDE
|
||||
Comment[ru]=Параметры бумажника
|
||||
Comment[sk]=Konfigurácia KDE Wallet
|
||||
Comment[sl]=Nastavitve Listnice KDE
|
||||
Comment[sq]=Konfigurim i Portofolit KDE
|
||||
Comment[sr]=Подешавање К‑новчаника
|
||||
Comment[sr@ijekavian]=Подешавање К‑новчаника
|
||||
Comment[sr@ijekavianlatin]=Podešavanje K‑novčanika
|
||||
Comment[sr@latin]=Podešavanje K‑novčanika
|
||||
Comment[sv]=Inställning av KDE-plånbok
|
||||
Comment[ta]=கேடிஇ வாலட் வடிவமைப்பு
|
||||
Comment[tg]=KDE Танзими Ҳамён
|
||||
Comment[th]=ปรับแต่งกระเป๋าคุมข้อมูลของ KDE
|
||||
Comment[tr]=KDE Cüzdan Yönetimi
|
||||
Comment[uk]=Налаштування KWallet
|
||||
Comment[uz]=KDE qopchiq xizmatini moslash
|
||||
Comment[uz@cyrillic]=KDE қопчиқ хизматини мослаш
|
||||
Comment[vi]=Cấu Hình Ví KDE
|
||||
Comment[x-test]=xxKDE Wallet Configurationxx
|
||||
Comment[zh_CN]=KDE 钱包配置
|
||||
Comment[zh_TW]=KDE 錢包設定
|
||||
X-KDE-Keywords=Wallet,Form Fill,Passwords,Form Data
|
||||
X-KDE-Keywords[bs]=Wallet,Form Fill,Passwords,Form Data;Novčanik;Lozinke;Formular
|
||||
X-KDE-Keywords[ca]=Cartera,Omplir formulari,Contrasenyes,Dades de formulari
|
||||
X-KDE-Keywords[ca@valencia]=Cartera,Omplir formulari,Contrasenyes,Dades de formulari
|
||||
X-KDE-Keywords[cs]=Úschovna,Vyplnění formuláře,Hesla,Data formuláře
|
||||
X-KDE-Keywords[da]=tegnebog,formularudfyldning,adgangskoder,formulardata
|
||||
X-KDE-Keywords[de]=Geheimfach,Formular,Passwort,Passwortspeicher,Formulardaten
|
||||
X-KDE-Keywords[el]=Πορτοφόλι,συμπλήρωση φόρμας,κωδικοί πρόσβασης,δεδομένα φόρμας
|
||||
X-KDE-Keywords[en_GB]=Wallet,Form Fill,Passwords,Form Data
|
||||
X-KDE-Keywords[es]=Cartera,Rellenar formulario,Contraseñas,Datos de formulario
|
||||
X-KDE-Keywords[et]=turvalaegas,vormide täitmine,paroolid,vormiandmed
|
||||
X-KDE-Keywords[eu]=Zorroa, formularioak betetzea, pasahitzak, formularioko datuak
|
||||
X-KDE-Keywords[fi]=Lompakko,Lomakkeen täydennys,Lomakkeen täydentäminen,Salasanat,Lomaketiedot,Lomakkeiden tiedot
|
||||
X-KDE-Keywords[fr]=Portefeuille,remplissage de formulaires,mots de passe,données de formulaires
|
||||
X-KDE-Keywords[ga]=Wallet,Líonadh Foirmeacha,Focal Faire,Sonraí foirme
|
||||
X-KDE-Keywords[gl]=Wallet,Form Fill,Passwords,Form Data,carteira,formulario,contrasinais
|
||||
X-KDE-Keywords[hu]=Jelszótároló,űrlapkitöltés,jelszavak,űrlapadat
|
||||
X-KDE-Keywords[ia]=Portafolio, Reimplemento de Formulario,Contrasignos,Datos de formulario
|
||||
X-KDE-Keywords[it]=Portafogli,compilazione moduli,password,dati moduli
|
||||
X-KDE-Keywords[kk]=Wallet,Form Fill,Passwords,Form Data
|
||||
X-KDE-Keywords[km]=កាបូប បំពេញសំណុំបែបបទ ពាក្យសម្ងាត់ ទិន្នន័យសំណុំបែបបទ
|
||||
X-KDE-Keywords[ko]=Wallet,Form Fill,Passwords,Form Data,지갑,암호,비밀번호,양식,폼
|
||||
X-KDE-Keywords[lt]=Piniginė,Formos užpildymas,Spaltažodžiai,Formos duomenys
|
||||
X-KDE-Keywords[mr]=पाकीट,रकाना भरा,गुप्तशब्द,रकाना माहिती
|
||||
X-KDE-Keywords[nb]=Lommebok,Skjema,Passord,Skjemadata
|
||||
X-KDE-Keywords[nds]=Knipp,Passwöör,Kiekwarkdaten,Formulordaten
|
||||
X-KDE-Keywords[nl]=Portefeuille,Formulier invullen,wachtwoorden,formuliergegevens
|
||||
X-KDE-Keywords[pa]=ਵਾਲਿਟ,ਫਾਰਮ ਭਰਨਾ,ਪਾਸਵਰਡ,ਫਾਰਮ ਡਾਟਾ
|
||||
X-KDE-Keywords[pl]=Portfel,Wypełnienie formularza,Hasła,Dane formularza
|
||||
X-KDE-Keywords[pt]=Carteira,Preenchimento de Formulários,Senhas,Dados de Formulários
|
||||
X-KDE-Keywords[pt_BR]=carteira,preencher formulário,senha,dados de formulário
|
||||
X-KDE-Keywords[ro]=portofel,completare formular,parole,date formular,formular
|
||||
X-KDE-Keywords[ru]=Wallet,Form Fill,Passwords,Form Data,бумажник,пароли,формы
|
||||
X-KDE-Keywords[sk]=Peňaženka,Vypĺňanie formulárov,Heslá,Dáta formulára
|
||||
X-KDE-Keywords[sl]=listnica,dopolnjevanje obrazcev,gesla,podatki obrazcev
|
||||
X-KDE-Keywords[sr]=Wallet,Form Fill,Passwords,Form Data,новчаник,попуњавање формулара,лозинка
|
||||
X-KDE-Keywords[sr@ijekavian]=Wallet,Form Fill,Passwords,Form Data,новчаник,попуњавање формулара,лозинка
|
||||
X-KDE-Keywords[sr@ijekavianlatin]=Wallet,Form Fill,Passwords,Form Data,novčanik,popunjavanje formulara,lozinka
|
||||
X-KDE-Keywords[sr@latin]=Wallet,Form Fill,Passwords,Form Data,novčanik,popunjavanje formulara,lozinka
|
||||
X-KDE-Keywords[sv]=Plånbok,Formulär,Lösenord,Formulärdata
|
||||
X-KDE-Keywords[tr]=Cüzdan,Form Doldurma,Parolalar,Form Verileri
|
||||
X-KDE-Keywords[uk]=кишеня;торбинка;форма;форми;заповнення форм;пароль;паролі;дані форми;реєстрація
|
||||
X-KDE-Keywords[x-test]=xxWallet,Form Fill,Passwords,Form Dataxx
|
||||
X-KDE-Keywords[zh_CN]=Wallet,Form Fill,Passwords,Form Data,钱包,表单填写,密码,表单数据
|
||||
X-KDE-Keywords[zh_TW]=Wallet,Form Fill,Passwords,Form Data
|
|
@ -1,77 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=Wallet Management Tool
|
||||
Name[ar]=أداة إدارة المحفظة
|
||||
Name[ast]=Ferramienta pa xestionar cartera
|
||||
Name[bg]=Инструмент за настройване на "Портфейл"
|
||||
Name[br]=Merour an doug-paperoù
|
||||
Name[bs]=Alatka za upravljanje novčanicima
|
||||
Name[ca]=Eina de gestió de carteres
|
||||
Name[ca@valencia]=Eina de gestió de carteres
|
||||
Name[cs]=Nástroj pro správu úschovny
|
||||
Name[cy]=Erfyn Rheoli Waled
|
||||
Name[da]=Håndteringsværktøj for tegnebog
|
||||
Name[de]=Passwortverwaltung
|
||||
Name[el]=Εργαλείο διαχείρισης πορτοφολιού
|
||||
Name[en_GB]=Wallet Management Tool
|
||||
Name[eo]=Paperuja administrilo
|
||||
Name[es]=Herramienta de gestión de cartera
|
||||
Name[et]=Turvalaeka haldur
|
||||
Name[eu]=Zorroa kudeatzeko tresna
|
||||
Name[fa]=ابزار مدیریت Wallet
|
||||
Name[fi]=Lompakonhallinta
|
||||
Name[fr]=Outil de gestion de portefeuilles
|
||||
Name[ga]=Uirlis Bhainisteoireachta Wallet
|
||||
Name[gl]=Utilidade de xestión de carteiras
|
||||
Name[he]=כלי לניהול הארנק של KDE
|
||||
Name[hne]=बटुआ प्रबंधन औजार
|
||||
Name[hr]=Alat za upravljanje novčanikom
|
||||
Name[hu]=Jelszókezelő eszköz
|
||||
Name[ia]=Instrumento de gestion de portafolio
|
||||
Name[id]=Perkakas Manajemen Dompet
|
||||
Name[is]=Tól til að stýra eiginleikum veskisins
|
||||
Name[it]=Strumento per la gestione dei portafogli
|
||||
Name[ja]=ウォレット管理ツール
|
||||
Name[kk]=Әмиянын басқару құралы
|
||||
Name[km]=ឧបករណ៍គ្រប់គ្រងកាបូប
|
||||
Name[ko]=지갑 관리 도구
|
||||
Name[lt]=Spatažodinių tvarkymo įrankis
|
||||
Name[lv]=Maka pārvaldības rīks
|
||||
Name[mk]=Алатка за менаџирање на паричници
|
||||
Name[mr]=पाकीट व्यवस्थापन साधन
|
||||
Name[nb]=Wallet administrasjonsverktøy
|
||||
Name[nds]=Knippenpleger
|
||||
Name[ne]=वालेट व्यवस्थापन उपकरण
|
||||
Name[nl]=Portefeuillebeheer
|
||||
Name[nn]=Wallet-administrasjonsverktøy
|
||||
Name[pa]=ਵਾਲਿਟ ਪਰਬੰਧਨ ਟੂਲ
|
||||
Name[pl]=Narzędzie do zarządzania portfelem
|
||||
Name[pt]=Ferramenta de Gestão da Carteira
|
||||
Name[pt_BR]=Ferramenta de gerenciamento de carteiras
|
||||
Name[ro]=Administrare portofel
|
||||
Name[ru]=Управление бумажниками
|
||||
Name[sk]=Nástroj pre správu KDE Wallet
|
||||
Name[sl]=Orodje za upravljanje z listnicami
|
||||
Name[sq]=Mjet i Menaxhimit të Portofolit
|
||||
Name[sr]=Алатка за управљање новчаницима
|
||||
Name[sr@ijekavian]=Алатка за управљање новчаницима
|
||||
Name[sr@ijekavianlatin]=Alatka za upravljanje novčanicima
|
||||
Name[sr@latin]=Alatka za upravljanje novčanicima
|
||||
Name[sv]=Hanteringsverktyg för plånbok
|
||||
Name[ta]=வாலட் மேலாண்மை கருவி
|
||||
Name[tg]=Асбоби Идоракунии Ҳамён
|
||||
Name[th]=เครื่องมือจัดการกระเป๋าคุมข้อมูล
|
||||
Name[tr]=Cüzdan Yönetim Aracı
|
||||
Name[ug]=ھەميان باشقۇرۇش قورالى
|
||||
Name[uk]=Засіб керування торбинками
|
||||
Name[uz]=Qopchiq boshqarish vositasi
|
||||
Name[uz@cyrillic]=Қопчиқ бошқариш воситаси
|
||||
Name[vi]=Công Cụ Quản Lý Ví
|
||||
Name[x-test]=xxWallet Management Toolxx
|
||||
Name[zh_CN]=钱包管理工具
|
||||
Name[zh_TW]=錢包管理工具
|
||||
Exec=kwalletmanager --show
|
||||
MimeType=application/x-kwallet;
|
||||
InitialPreference=6
|
||||
Icon=kwalletmanager
|
||||
Type=Service
|
||||
X-KDE-StartupNotify=true
|
|
@ -1,497 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WalletConfigWidget</class>
|
||||
<widget class="QWidget" name="WalletConfigWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget2">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab1">
|
||||
<attribute name="title">
|
||||
<string>Wallet Preferences</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_enabled">
|
||||
<property name="whatsThis">
|
||||
<string><p>The wallet subsystem provides a convenient and secure way to manage all your passwords. This option specifies whether or not you want to use it.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Enable the KDE wallet subsystem</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox2">
|
||||
<property name="whatsThis">
|
||||
<string>It is best to close your wallets when you are not using them to prevent others from viewing or using them.</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Close Wallet</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_closeIdle">
|
||||
<property name="whatsThis">
|
||||
<string><p><b>Close wallet after a period of inactivity.</b><br>When a wallet is closed the password is needed to access it again.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close when unused for:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="_idleTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><p><b>Close wallet after a period of inactivity.</b><br>When a wallet is closed the password is needed to access it again.</p></string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> min</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_screensaverLock">
|
||||
<property name="whatsThis">
|
||||
<string><p><b>Close wallet as soon as the screensaver starts.</b><br>When a wallet is closed the password is needed to access it again.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close when screensaver starts</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_autoclose">
|
||||
<property name="whatsThis">
|
||||
<string><p><b>Close wallet as soon as applications that use it have stopped.</b><br>Note that your wallet will only be closed when all applications that use it have stopped.<br>When a wallet is closed the password is needed to access it again.</p></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close when last application stops using it</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox4">
|
||||
<property name="title">
|
||||
<string>Automatic Wallet Selection</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel1_2">
|
||||
<property name="text">
|
||||
<string>Select wallet to use as default:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="_defaultWallet">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="_newWallet">
|
||||
<property name="text">
|
||||
<string>New...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="_localWalletSelected">
|
||||
<property name="text">
|
||||
<string>Different wallet for local passwords:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="_localWallet">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="_newLocalWallet">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox3">
|
||||
<property name="title">
|
||||
<string>Wallet Manager</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_launchManager">
|
||||
<property name="text">
|
||||
<string>Show manager in system tray</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_autocloseManager">
|
||||
<property name="text">
|
||||
<string>Hide system tray icon when last wallet closes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab2">
|
||||
<attribute name="title">
|
||||
<string>Access Control</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_openPrompt">
|
||||
<property name="text">
|
||||
<string>&Prompt when an application accesses a wallet</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="_accessList">
|
||||
<property name="rootIsDecorated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Wallet</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Application</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Policy</string>
|
||||
</property>
|
||||
<property name="clickable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="_launch">
|
||||
<property name="text">
|
||||
<string>&Launch Wallet Manager</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>_localWalletSelected</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>_newLocalWallet</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_localWalletSelected</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>_localWallet</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_closeIdle</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>_idleTime</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_enabled</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>groupBox2</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_enabled</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>groupBox4</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_enabled</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>groupBox3</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_closeIdle</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>_idleTime</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>_launchManager</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>_autocloseManager</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,37 +0,0 @@
|
|||
########### next target ###############
|
||||
|
||||
set(kwalletmanager_SRCS
|
||||
kwalletmanager.cpp
|
||||
kwalletmanagerwidget.cpp
|
||||
kwalletmanagerwidgetitem.cpp
|
||||
walletcontrolwidget.cpp
|
||||
main.cpp
|
||||
kwalletpopup.cpp
|
||||
kwalleteditor.cpp
|
||||
kwmapeditor.cpp
|
||||
allyourbase.cpp
|
||||
kbetterthankdialogbase.cpp
|
||||
registercreateactionmethod.cpp
|
||||
applicationsmanager.cpp
|
||||
connectedapplicationstable.cpp
|
||||
connectedappmodel.cpp
|
||||
disconnectappbutton.cpp
|
||||
authorizedappmodel.cpp
|
||||
authorizedapplicationstable.cpp
|
||||
revokeauthbutton.cpp
|
||||
walletwidget.ui
|
||||
kbetterthankdialogbase.ui
|
||||
walletcontrolwidget.ui
|
||||
applicationsmanager.ui
|
||||
)
|
||||
|
||||
qt4_add_dbus_interface(kwalletmanager_SRCS ${KDE4_DBUS_INTERFACES_INSTALL_DIR}/org.kde.KWallet.xml kwallet_interface)
|
||||
|
||||
add_executable(kwalletmanager ${kwalletmanager_SRCS})
|
||||
|
||||
target_link_libraries(kwalletmanager ${KDE4_KIO_LIBS})
|
||||
|
||||
install(TARGETS kwalletmanager ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||
install( FILES kwalletmanager.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/kwalletmanager)
|
||||
|
||||
kde4_install_icons( ${KDE4_ICON_INSTALL_DIR} )
|
|
@ -1,4 +0,0 @@
|
|||
#! /bin/sh
|
||||
$EXTRACTRC `find . -name '*.ui' -or -name '*.rc'` >> rc.cpp || exit 11
|
||||
$XGETTEXT `find . -name '*.h' -o -name '*.cpp' | grep -v '/tests/'` -o $podir/kwalletmanager.pot
|
||||
rm -f rc.cpp
|
|
@ -1,680 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2003-2005 George Staikos <staikos@kde.org>
|
||||
Copyright (C) 2005 Isaac Clerencia <isaac@warp.es>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "allyourbase.h"
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kglobal.h>
|
||||
#include <kio/netaccess.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kurl.h>
|
||||
#include <kwallet.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QApplication>
|
||||
//Added by qt3to4:
|
||||
#include <QPixmap>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/qevent.h>
|
||||
|
||||
/****************
|
||||
* KWalletFolderItem - ListView items to represent kwallet folders
|
||||
*/
|
||||
KWalletFolderItem::KWalletFolderItem(KWallet::Wallet *w, QTreeWidget* parent, const QString &name, int entries)
|
||||
: QTreeWidgetItem(parent, KWalletFolderItemClass),_wallet(w),_name(name),_entries(entries) {
|
||||
setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(_entries));
|
||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
|
||||
setIcon(0, getFolderIcon(KIconLoader::Small));
|
||||
}
|
||||
|
||||
QPixmap KWalletFolderItem::getFolderIcon(KIconLoader::Group group){
|
||||
KIconLoader *loader = KIconLoader::global();
|
||||
QPixmap pix = loader->loadIcon( _name, group, 0,
|
||||
KIconLoader::DefaultState, QStringList(),0, true );
|
||||
if (pix.isNull()) {
|
||||
pix = loader->loadIcon( _name.toLower(), group, 0,
|
||||
KIconLoader::DefaultState, QStringList(),0, true);
|
||||
}
|
||||
if (pix.isNull()) {
|
||||
pix = loader->loadIcon( QLatin1String( "folder-red" ), group, 0,
|
||||
KIconLoader::DefaultState, QStringList(),0, true);
|
||||
}
|
||||
return pix;
|
||||
}
|
||||
|
||||
void KWalletFolderItem::refresh() {
|
||||
const QString saveFolder = _wallet->currentFolder();
|
||||
_wallet->setFolder(_name);
|
||||
setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(_wallet->entryList().count()));
|
||||
_wallet->setFolder(saveFolder);
|
||||
}
|
||||
|
||||
void KWalletFolderItem::refreshItemsCount()
|
||||
{
|
||||
int visibleLeafCount =0;
|
||||
for (int i=0; i < childCount(); i++) {
|
||||
QTreeWidgetItem* wi = child(i);
|
||||
if (wi->childCount()) {
|
||||
for (int l=0; l < wi->childCount(); l++) {
|
||||
QTreeWidgetItem* li = wi->child(l);
|
||||
if (!li->isHidden())
|
||||
visibleLeafCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(visibleLeafCount));
|
||||
}
|
||||
|
||||
KWalletContainerItem* KWalletFolderItem::getContainer(KWallet::Wallet::EntryType type) {
|
||||
for (int i = 0; i < childCount(); ++i) {
|
||||
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(child(i));
|
||||
if (!ci) {
|
||||
continue;
|
||||
}
|
||||
if (ci->entryType() == type) {
|
||||
return ci;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool KWalletFolderItem::contains(const QString& key) {
|
||||
return (getItem(key) != 0);
|
||||
}
|
||||
|
||||
QTreeWidgetItem* KWalletFolderItem::getItem(const QString& key) {
|
||||
for (int i = 0; i < childCount(); ++i) {
|
||||
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(child(i));
|
||||
if (!ci) {
|
||||
continue;
|
||||
}
|
||||
QTreeWidgetItem *tmp = ci->getItem(key);
|
||||
if (tmp) {
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool KWalletFolderItem::acceptDrop(const QMimeData *mimedata) const {
|
||||
return mimedata->hasFormat(QLatin1String("application/x-kwallet-entry")) ||
|
||||
mimedata->hasFormat(QLatin1String("text/uri-list"));
|
||||
}
|
||||
|
||||
QString KWalletFolderItem::name() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
KWalletFolderItem::~KWalletFolderItem() {
|
||||
}
|
||||
|
||||
/****************
|
||||
* KWalletContainerItem - ListView items to represent kwallet containers, i.e.
|
||||
* passwords, maps, ...
|
||||
*/
|
||||
KWalletContainerItem::KWalletContainerItem(QTreeWidgetItem* parent, const QString &name, KWallet::Wallet::EntryType entryType)
|
||||
: QTreeWidgetItem(parent, QStringList() << name, KWalletContainerItemClass), _type(entryType) {
|
||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
||||
}
|
||||
|
||||
KWalletContainerItem::~KWalletContainerItem() {
|
||||
}
|
||||
|
||||
KWallet::Wallet::EntryType KWalletContainerItem::entryType() {
|
||||
return _type;
|
||||
}
|
||||
|
||||
bool KWalletContainerItem::contains(const QString& key) {
|
||||
return getItem(key) != 0;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *KWalletContainerItem::getItem(const QString& key) {
|
||||
for (int i = 0; i < childCount(); ++i) {
|
||||
KWalletEntryItem* entryItem = dynamic_cast<KWalletEntryItem *>(child(i));
|
||||
if (entryItem && entryItem->name() == key) {
|
||||
return entryItem;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************
|
||||
* KWalletEntryItem - ListView items to represent kwallet entries
|
||||
*/
|
||||
KWalletEntryItem::KWalletEntryItem(KWallet::Wallet *w, QTreeWidgetItem* parent, const QString& ename)
|
||||
: QTreeWidgetItem(parent, QStringList() << ename, KWalletEntryItemClass), _wallet(w), m_name(ename) {
|
||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
||||
}
|
||||
|
||||
KWalletEntryItem::~KWalletEntryItem() {
|
||||
}
|
||||
|
||||
void KWalletEntryItem::setName(const QString& n)
|
||||
{
|
||||
m_name = n;
|
||||
QTreeWidgetItem::setText(0, n);
|
||||
}
|
||||
|
||||
void KWalletEntryItem::restoreName()
|
||||
{
|
||||
QTreeWidgetItem::setText(0, m_name);
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
* KWalletItem - IconView items to represent wallets
|
||||
*/
|
||||
KWalletItem::KWalletItem(QListWidget *parent, const QString& walletName)
|
||||
: QListWidgetItem(DesktopIcon(QLatin1String( "wallet-closed" )), walletName, parent), _open(false) {
|
||||
setFlags(flags() | Qt::ItemIsDropEnabled);
|
||||
}
|
||||
|
||||
KWalletItem::~KWalletItem() {
|
||||
}
|
||||
|
||||
void KWalletItem::setOpen(bool state) {
|
||||
if (_open != state) {
|
||||
_open = state;
|
||||
if (_open) {
|
||||
setIcon( DesktopIcon(QLatin1String( "wallet-open" )) );
|
||||
} else {
|
||||
setIcon( DesktopIcon(QLatin1String( "wallet-closed" )) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool decodeEntry(KWallet::Wallet *_wallet, QDataStream& ds) {
|
||||
quint32 magic;
|
||||
ds >> magic;
|
||||
if (magic != KWALLETENTRYMAGIC) {
|
||||
kDebug() << "bad magic" ;
|
||||
return false;
|
||||
}
|
||||
QString name;
|
||||
QByteArray value;
|
||||
KWallet::Wallet::EntryType et;
|
||||
ds >> name;
|
||||
if (_wallet->hasEntry(name)) {
|
||||
int rc = KMessageBox::warningContinueCancel(0L, i18n("An entry by the name '%1' already exists. Would you like to continue?", name));
|
||||
if (rc == KMessageBox::Cancel) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
qint32 l;
|
||||
ds >> l;
|
||||
et = KWallet::Wallet::EntryType(l);
|
||||
ds >> value;
|
||||
_wallet->writeEntry(name, value, et);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool decodeFolder(KWallet::Wallet *_wallet, QDataStream& ds) {
|
||||
quint32 magic;
|
||||
ds >> magic;
|
||||
if (magic != KWALLETFOLDERMAGIC) {
|
||||
kDebug() << "bad magic" ;
|
||||
return false;
|
||||
}
|
||||
QString folder;
|
||||
ds >> folder;
|
||||
if (_wallet->hasFolder(folder)) {
|
||||
int rc = KMessageBox::warningYesNoCancel(0L, i18n("A folder by the name '%1' already exists. What would you like to do?", folder), QString(), KStandardGuiItem::cont(), KGuiItem(i18n("Replace")));
|
||||
if (rc == KMessageBox::Cancel) {
|
||||
return false;
|
||||
}
|
||||
if (rc == KMessageBox::No) {
|
||||
_wallet->removeFolder(folder);
|
||||
_wallet->createFolder(folder);
|
||||
}
|
||||
} else {
|
||||
_wallet->createFolder(folder);
|
||||
}
|
||||
|
||||
_wallet->setFolder(folder);
|
||||
while (!ds.atEnd()) {
|
||||
QString name;
|
||||
QByteArray value;
|
||||
KWallet::Wallet::EntryType et;
|
||||
ds >> name;
|
||||
qint32 l;
|
||||
ds >> l;
|
||||
et = KWallet::Wallet::EntryType(l);
|
||||
ds >> value;
|
||||
_wallet->writeEntry(name, value, et);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void KWalletItem::processDropEvent(QDropEvent *e) {
|
||||
const QMimeData *em = e->mimeData();
|
||||
if (em->hasFormat(QLatin1String("application/x-kwallet-folder")) ||
|
||||
em->hasFormat(QLatin1String("text/uri-list"))) {
|
||||
// FIXME: don't allow the drop if the wallet name is the same
|
||||
KWallet::Wallet *_wallet = KWallet::Wallet::openWallet(text(), listWidget()->window()->winId());
|
||||
if (!_wallet) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
const QString saveFolder = _wallet->currentFolder();
|
||||
|
||||
QDataStream *ds = 0L;
|
||||
|
||||
if (em->hasFormat(QLatin1String("application/x-kwallet-folder"))) {
|
||||
QByteArray edata = em->data(QLatin1String("application/x-kwallet-folder"));
|
||||
if (!edata.isEmpty()) {
|
||||
ds = new QDataStream(&edata, QIODevice::ReadOnly);
|
||||
}
|
||||
} else { // text/uri-list
|
||||
const QList<QUrl> urls = e->mimeData()->urls();
|
||||
if (urls.isEmpty()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
KUrl u(urls.first());
|
||||
if (u.fileName().isEmpty()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
QString tmpFile;
|
||||
if (KIO::NetAccess::download(u, tmpFile, 0L)) {
|
||||
QFile file;
|
||||
file.setFileName(tmpFile);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
ds = new QDataStream(&file);
|
||||
KIO::NetAccess::removeTempFile(tmpFile);
|
||||
} else {
|
||||
KMessageBox::error(listWidget(), KIO::NetAccess::lastErrorString());
|
||||
}
|
||||
}
|
||||
if (ds) {
|
||||
decodeFolder(_wallet, *ds);
|
||||
delete ds;
|
||||
}
|
||||
_wallet->setFolder(saveFolder);
|
||||
delete _wallet;
|
||||
|
||||
//delete the folder from the source if we were moving
|
||||
Qt::MouseButtons state = QApplication::mouseButtons();
|
||||
if (e->source() && e->source()->parent() &&
|
||||
!strcmp(e->source()->parent()->metaObject()->className(), "KWalletEntryList") &&
|
||||
!(state & Qt::ControlModifier)) {
|
||||
|
||||
KWalletEntryList *el = dynamic_cast<KWalletEntryList*>(e->source()->parent());
|
||||
if (el) {
|
||||
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem*>(el->currentItem());
|
||||
if (fi) {
|
||||
el->_wallet->removeFolder(fi->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
e->accept();
|
||||
} else {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/****************
|
||||
* KWalletEntryList - A listview to store wallet entries
|
||||
*/
|
||||
KWalletEntryList::KWalletEntryList(QWidget *parent, const char *name)
|
||||
: QTreeWidget(parent),
|
||||
_wallet(0) {
|
||||
setObjectName( QLatin1String( name ) );
|
||||
setColumnCount(1);
|
||||
setHeaderLabel(i18n("Folders"));
|
||||
setRootIsDecorated(true);
|
||||
setDragEnabled(true);
|
||||
setAcceptDrops(true);
|
||||
setDragDropMode(DragDrop);
|
||||
setSelectionMode(SingleSelection);
|
||||
}
|
||||
|
||||
KWalletEntryList::~KWalletEntryList() {
|
||||
}
|
||||
|
||||
//returns true if the item has been dropped successfully
|
||||
void KWalletEntryList::itemDropped(QDropEvent *e, QTreeWidgetItem *item) {
|
||||
bool ok = true;
|
||||
bool isEntry;
|
||||
QFile file;
|
||||
QDataStream *ds;
|
||||
|
||||
KWalletEntryList *el = 0L;
|
||||
QTreeWidgetItem *sel = 0L;
|
||||
|
||||
//detect if we are dragging from kwallet itself
|
||||
kDebug() << e->source() << e->source()->metaObject()->className();
|
||||
if (e->source() && !strcmp(e->source()->metaObject()->className(), "KWalletEntryList")) {
|
||||
el = dynamic_cast<KWalletEntryList*>(e->source());
|
||||
if (!el) {
|
||||
KMessageBox::error(this, i18n("An unexpected error occurred trying to drop the item"));
|
||||
} else
|
||||
sel = el->currentItem();
|
||||
}
|
||||
|
||||
const QMimeData *em = e->mimeData();
|
||||
if (em->hasFormat(QLatin1String("application/x-kwallet-entry"))) {
|
||||
//do nothing if we are in the same folder
|
||||
if (sel && sel->parent()->parent() == KWalletEntryList::getItemFolder(item)) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
isEntry = true;
|
||||
QByteArray data = em->data(QLatin1String("application/x-kwallet-entry"));
|
||||
if (data.isEmpty()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
ds = new QDataStream(&data, QIODevice::ReadOnly);
|
||||
} else if (em->hasFormat(QLatin1String("application/x-kwallet-folder"))) {
|
||||
//do nothing if we are in the same wallet
|
||||
if (this == el) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
isEntry = false;
|
||||
QByteArray data = em->data(QLatin1String("application/x-kwallet-folder"));
|
||||
if (data.isEmpty()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
ds = new QDataStream(&data, QIODevice::ReadOnly);
|
||||
} else if (em->hasFormat(QLatin1String("text/uri-list"))) {
|
||||
const QList<QUrl> urls = e->mimeData()->urls();
|
||||
if (urls.isEmpty()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
KUrl u(urls.first());
|
||||
if (u.fileName().isEmpty()) {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
QString tmpFile;
|
||||
if (KIO::NetAccess::download(u, tmpFile, 0L)) {
|
||||
file.setFileName(tmpFile);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
ds = new QDataStream(&file);
|
||||
//check magic to discover mime type
|
||||
quint32 magic;
|
||||
(*ds) >> magic;
|
||||
delete ds;
|
||||
if (magic == KWALLETENTRYMAGIC) {
|
||||
isEntry = true;
|
||||
} else if (magic == KWALLETFOLDERMAGIC) {
|
||||
isEntry = false;
|
||||
} else {
|
||||
kDebug() << "bad magic" ;
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
//set the file back to the beginning
|
||||
file.reset();
|
||||
ds = new QDataStream(&file);
|
||||
KIO::NetAccess::removeTempFile(tmpFile);
|
||||
} else {
|
||||
KMessageBox::error(this, KIO::NetAccess::lastErrorString());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
e->ignore();
|
||||
return;
|
||||
}
|
||||
Qt::MouseButtons state = QApplication::mouseButtons();
|
||||
if (isEntry) {
|
||||
if (!item) {
|
||||
e->ignore();
|
||||
delete(ds);
|
||||
return;
|
||||
}
|
||||
KWalletFolderItem *fi = KWalletEntryList::getItemFolder(item);
|
||||
if (!fi) {
|
||||
KMessageBox::error(this, i18n("An unexpected error occurred trying to drop the entry"));
|
||||
delete(ds);
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
QString saveFolder = _wallet->currentFolder();
|
||||
_wallet->setFolder(fi->name());
|
||||
ok = decodeEntry(_wallet, *ds);
|
||||
_wallet->setFolder(saveFolder);
|
||||
fi->refresh();
|
||||
delete(ds);
|
||||
//delete source if we were moving, i.e., we are dragging
|
||||
//from kwalletmanager and Control is not pressed
|
||||
if (ok && el && !(state & Qt::ControlModifier) && sel) {
|
||||
el->_wallet->removeEntry(sel->text(0));
|
||||
delete sel;
|
||||
}
|
||||
e->accept();
|
||||
} else {
|
||||
ok = decodeFolder(_wallet, *ds);
|
||||
delete ds;
|
||||
//delete source if we were moving, i.e., we are dragging
|
||||
//from kwalletmanager and Control is not pressed
|
||||
if (ok && el && !(state & Qt::ControlModifier) && sel) {
|
||||
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(sel);
|
||||
if (fi) {
|
||||
el->_wallet->removeFolder(fi->name());
|
||||
delete sel;
|
||||
} else {
|
||||
KMessageBox::error(this, i18n("An unexpected error occurred trying to delete the original folder, but the folder has been copied successfully"));
|
||||
}
|
||||
}
|
||||
e->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void KWalletEntryList::setWallet(KWallet::Wallet *w) {
|
||||
_wallet = w;
|
||||
}
|
||||
|
||||
bool KWalletEntryList::existsFolder(const QString& name) {
|
||||
for (int i = 0; i < topLevelItemCount(); ++i) {
|
||||
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
|
||||
if (!fi) {
|
||||
continue;
|
||||
}
|
||||
if (name == fi->name()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const {
|
||||
QMimeData *sd = 0L;
|
||||
if (i->type() == KWalletEntryItemClass) {
|
||||
const KWalletEntryItem *ei = dynamic_cast<const KWalletEntryItem*>(i);
|
||||
if (!ei) {
|
||||
return 0L;
|
||||
}
|
||||
KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem*>(ei->parent());
|
||||
if (!ci) {
|
||||
return 0L;
|
||||
}
|
||||
sd = new QMimeData();
|
||||
QByteArray a;
|
||||
QDataStream ds(&a, QIODevice::WriteOnly);
|
||||
|
||||
ds.setVersion(QDataStream::Qt_4_8);
|
||||
ds << KWALLETENTRYMAGIC;
|
||||
ds << ei->text(0);
|
||||
ds << ci->entryType();
|
||||
QByteArray value;
|
||||
ei->_wallet->readEntry(i->text(0), value);
|
||||
ds << value;
|
||||
sd->setData("application/x-kwallet-entry", a);
|
||||
} else if (i->type() == KWalletFolderItemClass) {
|
||||
const KWalletFolderItem *fi = dynamic_cast<const KWalletFolderItem*>(i);
|
||||
if (!fi) {
|
||||
return 0L;
|
||||
}
|
||||
sd = new QMimeData();
|
||||
QByteArray a;
|
||||
QDataStream ds(&a, QIODevice::WriteOnly);
|
||||
|
||||
ds.setVersion(QDataStream::Qt_4_8);
|
||||
|
||||
ds << KWALLETFOLDERMAGIC;
|
||||
ds << *fi;
|
||||
sd->setData("application/x-kwallet-folder", a);
|
||||
}
|
||||
return sd;
|
||||
}
|
||||
|
||||
void KWalletEntryList::mousePressEvent(QMouseEvent *e) {
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
_mousePos = e->pos();
|
||||
}
|
||||
QTreeWidget::mousePressEvent( e );
|
||||
}
|
||||
|
||||
void KWalletEntryList::mouseMoveEvent(QMouseEvent *e) {
|
||||
if (!(e->buttons() & Qt::LeftButton)) {
|
||||
return;
|
||||
}
|
||||
if ((e->pos() - _mousePos).manhattanLength() < QApplication::startDragDistance()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const QTreeWidgetItem *item = itemAt(_mousePos);
|
||||
if (!item || !item->isSelected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QMimeData *mimeData = itemMimeData(item);
|
||||
if (mimeData) {
|
||||
QDrag *drag = new QDrag(this);
|
||||
drag->setMimeData(mimeData);
|
||||
drag->setHotSpot(QPoint(0,0));
|
||||
drag->exec();
|
||||
}
|
||||
}
|
||||
|
||||
void KWalletEntryList::dropEvent(QDropEvent *e) {
|
||||
QTreeWidgetItem *i = itemAt(e->pos());
|
||||
itemDropped(e, i);
|
||||
}
|
||||
|
||||
void KWalletEntryList::dragEnterEvent(QDragEnterEvent *e) {
|
||||
e->accept();
|
||||
}
|
||||
|
||||
void KWalletEntryList::dragMoveEvent(QDragMoveEvent *e) {
|
||||
QTreeWidgetItem *i = itemAt(e->pos());
|
||||
e->ignore();
|
||||
const QMimeData *em = e->mimeData();
|
||||
if (i) {
|
||||
if (em->hasFormat(QLatin1String("application/x-kwallet-entry")) ||
|
||||
em->hasFormat(QLatin1String("text/uri-list"))) {
|
||||
e->accept();
|
||||
}
|
||||
}
|
||||
if ((em->hasFormat(QLatin1String("application/x-kwallet-folder")) &&
|
||||
e->source() != viewport()) ||
|
||||
em->hasFormat(QLatin1String("text/uri-list"))) {
|
||||
e->accept();
|
||||
}
|
||||
}
|
||||
|
||||
KWalletFolderItem* KWalletEntryList::getFolder(const QString& name) {
|
||||
for (int i = 0; i < topLevelItemCount(); ++i) {
|
||||
KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
|
||||
if (!fi) {
|
||||
continue;
|
||||
}
|
||||
if (name == fi->name()) {
|
||||
return fi;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
KWalletFolderItem *KWalletEntryList::getItemFolder(QTreeWidgetItem *item) {
|
||||
switch (item->type()) {
|
||||
case KWalletFolderItemClass:
|
||||
return dynamic_cast<KWalletFolderItem *>(item);
|
||||
case KWalletContainerItemClass:
|
||||
return dynamic_cast<KWalletFolderItem *>(item->parent());
|
||||
case KWalletEntryItemClass:
|
||||
return dynamic_cast<KWalletFolderItem *>(item->parent()->parent());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void KWalletEntryList::selectFirstVisible()
|
||||
{
|
||||
QTreeWidgetItemIterator it(this);
|
||||
while (*it) {
|
||||
QTreeWidgetItem *item = *it++;
|
||||
if (!item->isHidden()) {
|
||||
// if it's a leaf, then select it and quit
|
||||
if (item->childCount() ==0) {
|
||||
// kDebug() << "selecting " << item->text(0);
|
||||
setCurrentItem(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KWalletEntryList::refreshItemsCount()
|
||||
{
|
||||
QTreeWidgetItemIterator it(this);
|
||||
while (*it) {
|
||||
QTreeWidgetItem *item = *it++;
|
||||
KWalletFolderItem *fi = dynamic_cast< KWalletFolderItem* >(item);
|
||||
if (fi) {
|
||||
fi->refreshItemsCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ReturnPressedFilter : public QObject
|
||||
{
|
||||
public:
|
||||
ReturnPressedFilter(KListWidget *parent) : QObject(parent)
|
||||
{
|
||||
parent->installEventFilter(this);
|
||||
}
|
||||
|
||||
bool eventFilter(QObject * /*watched*/, QEvent *event)
|
||||
{
|
||||
if (event->type () == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return) {
|
||||
KListWidget *p = static_cast<KListWidget*>(parent());
|
||||
QMetaObject::invokeMethod(p, "executed", Q_ARG(QListWidgetItem*, p->currentItem()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#include "moc_allyourbase.cpp"
|
|
@ -1,174 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2003-2005 George Staikos <staikos@kde.org>
|
||||
Copyright (C) 2005 Isaac Clerencia <isaac@warp.es>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef ALLYOURBASE_H
|
||||
#define ALLYOURBASE_H
|
||||
|
||||
#include <kwallet.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kicontheme.h>
|
||||
#include <klistwidget.h>
|
||||
#include <QPixmap>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QTreeWidget>
|
||||
|
||||
#define KWALLETENTRYMAGIC ((quint32) 0x6B776C65)
|
||||
#define KWALLETFOLDERMAGIC ((quint32) 0x6B776C66)
|
||||
|
||||
|
||||
enum KWalletListItemClasses {
|
||||
KWalletFolderItemClass = QTreeWidgetItem::UserType,
|
||||
KWalletContainerItemClass,
|
||||
KWalletEntryItemClass,
|
||||
KWalletUnknownClass
|
||||
};
|
||||
|
||||
class KWalletEntryItem : public QTreeWidgetItem {
|
||||
public:
|
||||
KWalletEntryItem(KWallet::Wallet *w, QTreeWidgetItem* parent, const QString& ename);
|
||||
virtual ~KWalletEntryItem();
|
||||
|
||||
const QString& name() const { return m_name; }
|
||||
void setName(const QString& n);
|
||||
// Cancel renaming
|
||||
void restoreName();
|
||||
|
||||
public:
|
||||
KWallet::Wallet *_wallet;
|
||||
|
||||
private:
|
||||
void setText(int, const QString&) {} // forbidden
|
||||
QString m_name;
|
||||
};
|
||||
|
||||
class KWalletContainerItem : public QTreeWidgetItem {
|
||||
public:
|
||||
KWalletContainerItem(QTreeWidgetItem* parent, const QString& name, KWallet::Wallet::EntryType entryType);
|
||||
virtual ~KWalletContainerItem();
|
||||
|
||||
public:
|
||||
KWallet::Wallet::EntryType entryType();
|
||||
bool contains(const QString& itemKey);
|
||||
QTreeWidgetItem* getItem(const QString& itemKey);
|
||||
|
||||
private:
|
||||
KWallet::Wallet::EntryType _type;
|
||||
};
|
||||
|
||||
class KWalletFolderItem : public QTreeWidgetItem {
|
||||
public:
|
||||
KWalletFolderItem(KWallet::Wallet *w, QTreeWidget* parent, const QString& name, int entries);
|
||||
virtual ~KWalletFolderItem();
|
||||
|
||||
virtual bool acceptDrop(const QMimeData *mimedata) const;
|
||||
|
||||
QString name() const;
|
||||
void refresh();
|
||||
KWalletContainerItem* getContainer(KWallet::Wallet::EntryType type);
|
||||
QPixmap getFolderIcon(KIconLoader::Group group);
|
||||
bool contains(const QString& itemKey);
|
||||
QTreeWidgetItem* getItem(const QString& itemKey);
|
||||
void refreshItemsCount();
|
||||
|
||||
public:
|
||||
KWallet::Wallet *_wallet;
|
||||
|
||||
private:
|
||||
QString _name;
|
||||
int _entries;
|
||||
};
|
||||
|
||||
class KWalletEntryList : public QTreeWidget {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KWalletEntryList(QWidget *parent, const char *name = 0L);
|
||||
virtual ~KWalletEntryList();
|
||||
|
||||
bool existsFolder(const QString& name);
|
||||
KWalletFolderItem* getFolder(const QString& name);
|
||||
void setWallet(KWallet::Wallet *w);
|
||||
|
||||
protected:
|
||||
virtual void dragEnterEvent(QDragEnterEvent *e);
|
||||
virtual void dragMoveEvent(QDragMoveEvent *e);
|
||||
virtual void dropEvent(QDropEvent *e);
|
||||
virtual void mousePressEvent(QMouseEvent *e);
|
||||
virtual void mouseMoveEvent(QMouseEvent *e);
|
||||
|
||||
void itemDropped(QDropEvent *e, QTreeWidgetItem *item);
|
||||
|
||||
private:
|
||||
static KWalletFolderItem *getItemFolder(QTreeWidgetItem *item);
|
||||
QMimeData *itemMimeData(const QTreeWidgetItem *i) const;
|
||||
|
||||
public:
|
||||
KWallet::Wallet *_wallet;
|
||||
QPoint _mousePos;
|
||||
|
||||
public Q_SLOTS:
|
||||
void selectFirstVisible();
|
||||
void refreshItemsCount();
|
||||
};
|
||||
|
||||
class KWalletItem : public QListWidgetItem {
|
||||
public:
|
||||
KWalletItem(QListWidget *parent, const QString& walletName);
|
||||
virtual ~KWalletItem();
|
||||
|
||||
void setOpen(bool state);
|
||||
|
||||
void processDropEvent(QDropEvent *e);
|
||||
|
||||
private:
|
||||
bool _open;
|
||||
};
|
||||
|
||||
inline QDataStream& operator<<(QDataStream& str, const KWalletEntryItem& w) {
|
||||
QString name = w.text(0);
|
||||
str << name;
|
||||
KWallet::Wallet::EntryType et = w._wallet->entryType(name);
|
||||
str << qint64(et);
|
||||
QByteArray a;
|
||||
w._wallet->readEntry(name, a);
|
||||
str << a;
|
||||
return str;
|
||||
}
|
||||
|
||||
inline QDataStream& operator<<(QDataStream& str, const KWalletFolderItem& w) {
|
||||
QString oldFolder = w._wallet->currentFolder();
|
||||
str << w.name();
|
||||
w._wallet->setFolder(w.name());
|
||||
QStringList entries = w._wallet->entryList();
|
||||
foreach (const QString &entry, entries) {
|
||||
str << entry;
|
||||
KWallet::Wallet::EntryType et = w._wallet->entryType(entry);
|
||||
str << (qint32)et;
|
||||
QByteArray a;
|
||||
w._wallet->readEntry(entry, a);
|
||||
str << a;
|
||||
}
|
||||
w._wallet->setFolder(oldFolder);
|
||||
return str;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "applicationsmanager.h"
|
||||
#include "connectedappmodel.h"
|
||||
#include "authorizedappmodel.h"
|
||||
#include "kwallet.h"
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QPainter>
|
||||
#include <QStandardItemModel>
|
||||
#include <kdebug.h>
|
||||
|
||||
ApplicationsManager::ApplicationsManager(QWidget* parent):
|
||||
QWidget(parent),
|
||||
_wallet(0),
|
||||
_connectedAppsModel(0),
|
||||
_authorizedAppModel(0)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
ApplicationsManager::~ApplicationsManager()
|
||||
{
|
||||
delete _connectedAppsModel;
|
||||
delete _authorizedAppModel;
|
||||
}
|
||||
|
||||
void ApplicationsManager::setWallet(KWallet::Wallet* wallet)
|
||||
{
|
||||
Q_ASSERT(wallet != 0);
|
||||
_wallet = wallet;
|
||||
|
||||
// create the disconnect widget menu
|
||||
_connectedAppsModel = new ConnectedAppModel(_wallet);
|
||||
_connectedApps->setWallet(_wallet);
|
||||
_connectedApps->setModel(_connectedAppsModel);
|
||||
|
||||
_authorizedAppModel = new AuthorizedAppModel(_wallet);
|
||||
_authorizedApps->setWallet(_wallet);
|
||||
_authorizedApps->setModel(_authorizedAppModel);
|
||||
}
|
||||
|
||||
#include "moc_applicationsmanager.cpp"
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef APPLICATIONSMANAGER_H
|
||||
#define APPLICATIONSMANAGER_H
|
||||
|
||||
#include "ui_applicationsmanager.h"
|
||||
#include <QWidget>
|
||||
|
||||
class AuthorizedAppModel;
|
||||
class ConnectedAppModel;
|
||||
namespace KWallet {
|
||||
class Wallet;
|
||||
}
|
||||
|
||||
|
||||
class ApplicationsManager : public QWidget, public Ui::ApplicationsManager
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ApplicationsManager(QWidget *parent);
|
||||
virtual ~ApplicationsManager();
|
||||
|
||||
void setWallet(KWallet::Wallet *wallet);
|
||||
|
||||
private:
|
||||
KWallet::Wallet *_wallet;
|
||||
ConnectedAppModel *_connectedAppsModel;
|
||||
AuthorizedAppModel *_authorizedAppModel;
|
||||
};
|
||||
|
||||
#endif // APPLICATIONSMANAGER_H
|
|
@ -1,115 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ApplicationsManager</class>
|
||||
<widget class="QWidget" name="ApplicationsManager">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>620</width>
|
||||
<height>458</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>These applications are currently connected to this wallet:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ConnectedApplicationsTable" name="_connectedApps">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropOverwriteMode">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>These applications are authorized to access this wallet:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AuthorizedApplicationsTable" name="_authorizedApps">
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropOverwriteMode">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>ConnectedApplicationsTable</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>connectedapplicationstable.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AuthorizedApplicationsTable</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>authorizedapplicationstable.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "authorizedapplicationstable.h"
|
||||
#include "authorizedappmodel.h"
|
||||
#include "revokeauthbutton.h"
|
||||
|
||||
AuthorizedApplicationsTable::AuthorizedApplicationsTable(QWidget* parent) :
|
||||
QTableView(parent),
|
||||
_wallet(0)
|
||||
{
|
||||
}
|
||||
|
||||
void AuthorizedApplicationsTable::setWallet(KWallet::Wallet* wallet)
|
||||
{
|
||||
_wallet = wallet;
|
||||
}
|
||||
|
||||
void AuthorizedApplicationsTable::setModel(QAbstractItemModel* model)
|
||||
{
|
||||
Q_ASSERT(_wallet != 0);
|
||||
|
||||
AuthorizedAppModel *appModel = qobject_cast<AuthorizedAppModel*>(model);
|
||||
Q_ASSERT(appModel != 0);
|
||||
|
||||
QTableView::setModel(model);
|
||||
for (int row =0; row < model->rowCount(); row++) {
|
||||
RevokeAuthButton *btn = new RevokeAuthButton( model->index(row, 0).data().toString() , _wallet);
|
||||
btn->setFixedHeight(btn->sizeHint().height());
|
||||
setRowHeight(row, btn->height());
|
||||
setIndexWidget( model->index(row, 1), btn);
|
||||
connect(btn, SIGNAL(appRevoked(QString)), appModel, SLOT(removeApp(QString)));
|
||||
}
|
||||
}
|
||||
|
||||
void AuthorizedApplicationsTable::resizeEvent(QResizeEvent* resizeEvent)
|
||||
{
|
||||
// this will keep disconnect buttons column at it's minimum size and
|
||||
// make the application names take the reminder of the horizontal space
|
||||
resizeColumnsToContents();
|
||||
int appColumnSize = contentsRect().width() - columnWidth(1) - 50;
|
||||
setColumnWidth(0, appColumnSize);
|
||||
QAbstractItemView::resizeEvent(resizeEvent);
|
||||
}
|
||||
|
||||
#include "moc_authorizedapplicationstable.cpp"
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef AUTHORIZEDAPPLICATIONSTABLE_H
|
||||
#define AUTHORIZEDAPPLICATIONSTABLE_H
|
||||
|
||||
#include <QTableView>
|
||||
|
||||
namespace KWallet {
|
||||
class Wallet;
|
||||
}
|
||||
|
||||
class AuthorizedApplicationsTable : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AuthorizedApplicationsTable(QWidget* parent);
|
||||
|
||||
virtual void setModel(QAbstractItemModel *model);
|
||||
void setWallet(KWallet::Wallet *wallet);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *resizeEvent);
|
||||
|
||||
private:
|
||||
KWallet::Wallet *_wallet;
|
||||
};
|
||||
|
||||
#endif // AUTHORIZEDAPPLICATIONSTABLE_H
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "authorizedappmodel.h"
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
#include <kwallet.h>
|
||||
#include <kdebug.h>
|
||||
#include <QTimer>
|
||||
|
||||
AuthorizedAppModel::AuthorizedAppModel(KWallet::Wallet* wallet):
|
||||
QStandardItemModel(),
|
||||
_cfg(KSharedConfig::openConfig(QLatin1String( "kwalletrc" ), KConfig::NoGlobals)),
|
||||
_wallet(wallet)
|
||||
{
|
||||
// TODO: handle "Auto Deny" applications
|
||||
// KConfigGroup ad(_cfg, "Auto Deny");
|
||||
|
||||
KConfigGroup aa(_cfg, "Auto Allow");
|
||||
QString walletName = _wallet->walletName();
|
||||
const QStringList keys = aa.entryMap().keys();
|
||||
Q_FOREACH(QString cfgWalletName, keys) {
|
||||
if (cfgWalletName == walletName) {
|
||||
const QStringList apps = aa.readEntry(cfgWalletName, QStringList());
|
||||
int row = 0;
|
||||
Q_FOREACH(QString appName, apps) {
|
||||
setItem(row, 0, new QStandardItem(appName));
|
||||
setItem(row, 1, new QStandardItem("dummy")); // this item will be hidden by the disconnect button, see below setIndexWidget call
|
||||
_authorizedAppsIndexMap.insert(appName, QPersistentModelIndex(index(row, 0)));
|
||||
row++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuthorizedAppModel::removeApp(QString appName)
|
||||
{
|
||||
if (_authorizedAppsIndexMap.contains(appName)) {
|
||||
QPersistentModelIndex idx = _authorizedAppsIndexMap[appName];
|
||||
if (idx.isValid()) {
|
||||
if (!removeRow(idx.row())) {
|
||||
kDebug() << "Remove row failed for app " << appName;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kDebug() << "Attempting to remove unknown application " << appName;
|
||||
}
|
||||
QTimer::singleShot(0, this, SLOT(saveConfig()));
|
||||
}
|
||||
|
||||
void AuthorizedAppModel::saveConfig()
|
||||
{
|
||||
QStringList appList;
|
||||
for (int r=0; r <rowCount(); r++) {
|
||||
appList << item(r)->text();
|
||||
}
|
||||
QString walletName = _wallet->walletName();
|
||||
KConfigGroup config(_cfg, "Auto Allow");
|
||||
config.deleteEntry(walletName);
|
||||
config.writeEntry(_wallet->walletName(), appList);
|
||||
_cfg->sync();
|
||||
}
|
||||
|
||||
#include "moc_authorizedappmodel.cpp"
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef AUTHORIZEDAPPMODEL_H
|
||||
#define AUTHORIZEDAPPMODEL_H
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <ksharedconfig.h>
|
||||
|
||||
namespace KWallet {
|
||||
class Wallet;
|
||||
}
|
||||
|
||||
class AuthorizedAppModel : public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AuthorizedAppModel(KWallet::Wallet *wallet);
|
||||
|
||||
public Q_SLOTS:
|
||||
void removeApp(QString);
|
||||
|
||||
private Q_SLOTS:
|
||||
void saveConfig();
|
||||
|
||||
private:
|
||||
KSharedConfig::Ptr _cfg;
|
||||
KWallet::Wallet *_wallet;
|
||||
QMap<QString, QPersistentModelIndex> _authorizedAppsIndexMap;
|
||||
};
|
||||
|
||||
#endif // AUTHORIZEDAPPMODEL_H
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2013 Valentin Rusu <kde@rusu.info>
|
||||
|
||||
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; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "connectedapplicationstable.h"
|
||||
#include "disconnectappbutton.h"
|
||||
#include "connectedappmodel.h"
|
||||
|
||||
#include <klocalizedstring.h>
|
||||
#include <QPushButton>
|
||||
|
||||
ConnectedApplicationsTable::ConnectedApplicationsTable(QWidget* parent):
|
||||
QTableView(parent),
|
||||
_wallet(0)
|
||||
{
|
||||
}
|
||||
|
||||
void ConnectedApplicationsTable::setWallet(KWallet::Wallet* wallet)
|
||||
{
|
||||
_wallet = wallet;
|
||||
}
|
||||
|
||||
void ConnectedApplicationsTable::setModel(QAbstractItemModel* model)
|
||||
{
|
||||
Q_ASSERT(_wallet != 0);
|
||||
|
||||
ConnectedAppModel *appModel = qobject_cast<ConnectedAppModel*>(model);
|
||||
Q_ASSERT(appModel != 0);
|
||||
|
||||
QTableView::setModel(model);
|
||||
for (int row =0; row < model->rowCount(); row++) {
|
||||
DisconnectAppButton *btn = new DisconnectAppButton( model->index(row, 0).data().toString() , _wallet);
|
||||
btn->setFixedHeight(btn->sizeHint().height());
|
||||
setRowHeight(row, btn->height());
|
||||
setIndexWidget( model->index(row, 1), btn);
|
||||
connect(btn, SIGNAL(appDisconnected(QString)), appModel, SLOT(removeApp(QString)));
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectedApplicationsTable::resizeEvent(QResizeEvent* resizeEvent)
|
||||
{
|
||||
// this will keep disconnect buttons column at it's minimum size and
|
||||
// make the application names take the reminder of the horizontal space
|
||||
resizeColumnsToContents();
|
||||
int appColumnSize = contentsRect().width() - columnWidth(1) - 50;
|
||||
setColumnWidth(0, appColumnSize);
|
||||
QAbstractItemView::resizeEvent(resizeEvent);
|
||||
}
|
||||
|
||||
#include "moc_connectedapplicationstable.cpp"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue