diff options
Diffstat (limited to 'tdewallet')
46 files changed, 5277 insertions, 0 deletions
diff --git a/tdewallet/CMakeLists.txt b/tdewallet/CMakeLists.txt new file mode 100644 index 0000000..e4cedbe --- /dev/null +++ b/tdewallet/CMakeLists.txt @@ -0,0 +1,55 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( icons ) +add_subdirectory( konfigurator ) + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### tdewalletmanager (executable) ############### + +tde_add_executable( tdewalletmanager AUTOMOC + SOURCES walletwidget.ui tdewalletmanager.cpp + tdewalletmanager.skel main.cpp tdewalletpopup.cpp + tdewalleteditor.cpp kwmapeditor.cpp + allyourbase.cpp kbetterthankdialogbase.ui + LINK kio-shared + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### icons ##################################### + +tde_install_icons( tdewalletmanager) + + +##### other data ################################ + +install( FILES tdewalletmanager.rc tdewalleteditor.rc + DESTINATION ${DATA_INSTALL_DIR}/tdewalletmanager +) + +install( FILES tdewalletmanager.desktop + tdewalletmanager-tdewalletd.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) + diff --git a/tdewallet/Makefile.am b/tdewallet/Makefile.am new file mode 100644 index 0000000..d3d62cd --- /dev/null +++ b/tdewallet/Makefile.am @@ -0,0 +1,26 @@ +INCLUDES= $(all_includes) + +SUBDIRS=. icons konfigurator + +bin_PROGRAMS = tdewalletmanager +tdewalletmanager_SOURCES = walletwidget.ui tdewalletmanager.cpp \ + tdewalletmanager.skel main.cpp tdewalletpopup.cpp \ + tdewalleteditor.cpp kwmapeditor.cpp allyourbase.cpp \ + kbetterthankdialogbase.ui +tdewalletmanager_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +tdewalletmanager_LDADD = $(LIB_KIO) -ltdewalletclient +METASOURCES = AUTO +noinst_HEADERS = tdewalletmanager.h tdewalletpopup.h walletwidget.h tdewalleteditor.h\ + allyourbase.h kwmapeditor.h + +xdg_apps_DATA = tdewalletmanager.desktop tdewalletmanager-tdewalletd.desktop + +KDE_ICON = tdewalletmanager + +rc_DATA = tdewalletmanager.rc tdewalleteditor.rc +rcdir = $(kde_datadir)/tdewalletmanager + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/tdewalletmanager.pot + +kbetterthankdialogbase.lo: kbetterthankdialogbase.ui kbetterthankdialogbase.ui.h diff --git a/tdewallet/TODO b/tdewallet/TODO new file mode 100644 index 0000000..145fa7b --- /dev/null +++ b/tdewallet/TODO @@ -0,0 +1,13 @@ +Things left: + +Backend: +- test 64 bit, zSeries +- refactor the hashes to make it efficient + +Integration: +- Cookie jar +- KMail + +Future ideas: +- Make it a kpart + diff --git a/tdewallet/allyourbase.cpp b/tdewallet/allyourbase.cpp new file mode 100644 index 0000000..97b55d8 --- /dev/null +++ b/tdewallet/allyourbase.cpp @@ -0,0 +1,733 @@ +/* + Copyright (C) 2003-2005 George Staikos <[email protected]> + Copyright (C) 2005 Isaac Clerencia <[email protected]> + + 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 <kapplication.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kio/netaccess.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> +#include <kurl.h> +#include <kurldrag.h> +#include <tdewallet.h> + +#include <tqdragobject.h> +#include <tqfile.h> +#include <tqptrlist.h> + +/**************** + * KWalletFolderItem - ListView items to represent tdewallet folders + */ +KWalletFolderItem::KWalletFolderItem(KWallet::Wallet *w, TQListView* parent, const TQString &name, int entries) +: KListViewItem(parent),_wallet(w),_name(name),_entries(entries) { + setText(0, TQString("%1 (%2)").arg(_name).arg(_entries)); + setRenameEnabled(0, false); + setDragEnabled(true); + setDropEnabled(true); + + TQPixmap pix = getFolderIcon(KIcon::Small); + + setPixmap(0,pix); +} + +TQPixmap KWalletFolderItem::getFolderIcon(KIcon::Group group){ + KIconLoader *loader = TDEGlobal::instance()->iconLoader(); + TQPixmap pix = loader->loadIcon( _name, group, 0, + KIcon::DefaultState, 0, true ); + if (pix.isNull()) + pix = loader->loadIcon( _name.lower(), group, 0, + KIcon::DefaultState, 0, true); + if (pix.isNull()) + pix = loader->loadIcon( "folder_red", group, 0, + KIcon::DefaultState, 0, true); + return pix; +} + +void KWalletFolderItem::refresh() { + TQString saveFolder = _wallet->currentFolder(); + _wallet->setFolder(_name); + setText(0, TQString("%1 (%2)").arg(_name).arg(_wallet->entryList().count())); + _wallet->setFolder(saveFolder); +} + +KWalletContainerItem* KWalletFolderItem::getContainer(KWallet::Wallet::EntryType type) { + for (TQListViewItem *i = firstChild(); i; i = i->nextSibling()) { + KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(i); + if (!ci) { + continue; + } + if (ci->type() == type) { + return ci; + } + } + return 0; +} + +bool KWalletFolderItem::contains(const TQString& key) { + return (getItem(key) != 0); +} + +TQListViewItem* KWalletFolderItem::getItem(const TQString& key) { + for (TQListViewItem *i = firstChild(); i; i = i->nextSibling()) { + KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(i); + if (!ci) { + continue; + } + TQListViewItem *tmp = ci->getItem(key); + if (tmp) { + return tmp; + } + } + return 0; +} + +bool KWalletFolderItem::acceptDrop(const TQMimeSource *mime) const { + return mime->provides("application/x-tdewallet-entry") || + mime->provides("text/uri-list"); +} + +int KWalletFolderItem::rtti() const { + return KWalletFolderItemClass; +} + +TQString KWalletFolderItem::name() const { + return _name; +} + +KWalletFolderItem::~KWalletFolderItem() { +} + +/**************** + * KWalletContainerItem - ListView items to represent tdewallet containers, i.e. + * passwords, maps, ... + */ +KWalletContainerItem::KWalletContainerItem(TQListViewItem* parent, const TQString &name, KWallet::Wallet::EntryType type) +: KListViewItem(parent, name), _type(type) { + setRenameEnabled(0, false); + setDragEnabled(true); +} + +KWalletContainerItem::~KWalletContainerItem() { +} + +int KWalletContainerItem::rtti() const { + return KWalletContainerItemClass; +} + +KWallet::Wallet::EntryType KWalletContainerItem::type() { + return _type; +} + +bool KWalletContainerItem::contains(const TQString& key) { + return getItem(key) != 0; +} + +TQListViewItem *KWalletContainerItem::getItem(const TQString& key) { + for (TQListViewItem *i = firstChild(); i; i = i->nextSibling()) { + if (i->text(0) == key) { + return i; + } + } + return 0; +} + +/**************** + * KWalletEntryItem - ListView items to represent tdewallet entries + */ +KWalletEntryItem::KWalletEntryItem(KWallet::Wallet *w, TQListViewItem* parent, const TQString& ename) +: KListViewItem(parent, ename), _wallet(w), _oldName(ename) { + setRenameEnabled(0, true); + setDragEnabled(true); +} + +int KWalletEntryItem::rtti() const { + return KWalletEntryItemClass; +} + +KWalletEntryItem::~KWalletEntryItem() { +} + +/**************** + * KWalletItem - IconView items to represent wallets + */ +KWalletItem::KWalletItem(TQIconView *parent, const TQString& walletName) +: TQIconViewItem(parent, walletName, DesktopIcon("tdewalletmanager")) { +} + +KWalletItem::~KWalletItem() { +} + +bool KWalletItem::acceptDrop(const TQMimeSource *mime) const { + return mime->provides("application/x-tdewallet-folder") || + mime->provides("text/uri-list"); +} + +static bool decodeEntry(KWallet::Wallet *_wallet, TQDataStream& ds) { + TQ_UINT32 magic; + ds >> magic; + if (magic != KWALLETENTRYMAGIC) { + kdDebug() << "bad magic" << endl; + return false; + } + TQString name; + TQByteArray 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?").arg(name)); + if (rc == KMessageBox::Cancel) { + return false; + } + } + long l; + ds >> l; + et = KWallet::Wallet::EntryType(l); + ds >> value; + _wallet->writeEntry(name, value, et); + return true; +} + +static bool decodeFolder(KWallet::Wallet *_wallet, TQDataStream& ds) { + TQ_UINT32 magic; + ds >> magic; + if (magic != KWALLETFOLDERMAGIC) { + kdDebug() << "bad magic" << endl; + return false; + } + TQString 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?").arg(folder), TQString(), KStdGuiItem::cont(), 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()) { + TQString name; + TQByteArray value; + KWallet::Wallet::EntryType et; + ds >> name; + long l; + ds >> l; + et = KWallet::Wallet::EntryType(l); + ds >> value; + _wallet->writeEntry(name, value, et); + } + return true; +} + +void KWalletItem::dropped(TQDropEvent *e, const TQValueList<TQIconDragItem>& lst) { + Q_UNUSED(lst); + if (e->provides("application/x-tdewallet-folder") || + e->provides("text/uri-list")) { + + // FIXME: don't allow the drop if the wallet name is the same + + KWallet::Wallet *_wallet = KWallet::Wallet::openWallet(text()); + if (!_wallet) { + e->ignore(); + return; + } + + TQString saveFolder = _wallet->currentFolder(); + + TQFile file; + TQDataStream *ds = 0L; + + if (e->provides("application/x-tdewallet-folder")) { + TQByteArray edata = e->encodedData("application/x-tdewallet-folder"); + if (!edata.isEmpty()) { + ds = new TQDataStream(edata, IO_ReadOnly); + } + } else { // text/uri-list + TQStrList urls; + TQUriDrag::decode(e, urls); + + if (urls.isEmpty()) { + e->ignore(); + return; + } + + KURL u(urls.first()); + if (u.fileName().isEmpty()) { + e->ignore(); + return; + } + TQString tmpFile; + if (TDEIO::NetAccess::download(u, tmpFile, 0L)) { + file.setName(tmpFile); + file.open(IO_ReadOnly); + ds = new TQDataStream(&file); + TDEIO::NetAccess::removeTempFile(tmpFile); + } else { + KMessageBox::error(iconView(), TDEIO::NetAccess::lastErrorString()); + } + } + if (ds) { + decodeFolder(_wallet, *ds); + delete ds; + } + _wallet->setFolder(saveFolder); + delete _wallet; + + //delete the folder from the source if we were moving + TQt::ButtonState state = kapp->keyboardMouseState(); + if (e->source() && e->source()->parent() && + !strcmp(e->source()->parent()->className(), "KWalletEntryList") && + !(state & TQt::ControlButton)) { + + KWalletEntryList *el = + dynamic_cast<KWalletEntryList*>(e->source()->parent()); + if (el) { + KWalletFolderItem *fi = + dynamic_cast<KWalletFolderItem*>(el->selectedItem()); + if (fi) { + el->_wallet->removeFolder(fi->name()); + } + } + } + e->accept(); + } else { + e->ignore(); + return; + } +} + +/**************** + * KWalletEntryDrag - Stores data for wallet entry drags + */ +class KWalletEntryDrag : public TQStoredDrag { + public: + KWalletEntryDrag(TQWidget *dragSource, const char *name = 0L) + : TQStoredDrag("application/x-tdewallet-entry", dragSource, name) { + } + + virtual ~KWalletEntryDrag() {} +}; + +/**************** + * KWalletFolderDrag - Stores data for wallet folder drags + */ +class KWalletFolderDrag : public TQStoredDrag { + public: + KWalletFolderDrag(TQWidget *dragSource, const char *name = 0L) + : TQStoredDrag("application/x-tdewallet-folder", dragSource, name) { + } + + virtual ~KWalletFolderDrag() {} +}; + +/**************** + * KWalletEntryList - A listview to store wallet entries + */ +KWalletEntryList::KWalletEntryList(TQWidget *parent, const char *name) +: KListView(parent, name) { + addColumn(i18n("Folders")); + setRootIsDecorated(true); + setDefaultRenameAction(Reject); + setAcceptDrops(true); + setItemsMovable(false); + setDropVisualizer(false); + viewport()->setAcceptDrops(true); +} + +KWalletEntryList::~KWalletEntryList() { +} + +bool KWalletEntryList::acceptDrag(TQDropEvent* e) const { + TQListViewItem *i = itemAt(contentsToViewport(e->pos())); + if (i) { + if (e->provides("application/x-tdewallet-entry") || + e->provides("text/uri-list")) { + return true; + } + } + if ((e->provides("application/x-tdewallet-folder") && + e->source() != viewport()) || + e->provides("text/uri-list")) { + return true; + } + return false; +} + +//returns true if the item has been dropped successfully +void KWalletEntryList::itemDropped(TQDropEvent *e, TQListViewItem *item) { + bool ok = true; + bool isEntry; + TQFile file; + TQDataStream *ds; + + KWalletEntryList *el = 0L; + TQListViewItem *sel = 0L; + + //detect if we are dragging from tdewallet itself + if (e->source() && e->source()->parent() && + !strcmp(e->source()->parent()->className(), "KWalletEntryList")) { + + el = dynamic_cast<KWalletEntryList*>(e->source()->parent()); + if (!el) { + KMessageBox::error(this, i18n("An unexpected error occurred trying to drop the item")); + } else + sel = el->selectedItem(); + } + + if (e->provides("application/x-tdewallet-entry")) { + //do nothing if we are in the same folder + if (sel && sel->parent()->parent() == + KWalletEntryList::getItemFolder(item)) { + e->ignore(); + return; + } + isEntry = true; + TQByteArray data = e->encodedData("application/x-tdewallet-entry"); + if (data.isEmpty()) { + e->ignore(); + return; + } + ds = new TQDataStream(data, IO_ReadOnly); + } else if (e->provides("application/x-tdewallet-folder")) { + //do nothing if we are in the same wallet + if (this == el) { + e->ignore(); + return; + } + isEntry = false; + TQByteArray data = e->encodedData("application/x-tdewallet-folder"); + if (data.isEmpty()) { + e->ignore(); + return; + } + ds = new TQDataStream(data, IO_ReadOnly); + } else if (e->provides("text/uri-list")) { + TQStrList urls; + TQUriDrag::decode(e, urls); + if (urls.isEmpty()) { + e->ignore(); + return; + } + KURL u(urls.first()); + if (u.fileName().isEmpty()) { + e->ignore(); + return; + } + TQString tmpFile; + if (TDEIO::NetAccess::download(u, tmpFile, 0L)) { + file.setName(tmpFile); + file.open(IO_ReadOnly); + ds = new TQDataStream(&file); + //check magic to discover mime type + TQ_UINT32 magic; + (*ds) >> magic; + if (magic == KWALLETENTRYMAGIC) { + isEntry = true; + } else if (magic == KWALLETFOLDERMAGIC) { + isEntry = false; + } else { + kdDebug() << "bad magic" << endl; + e->ignore(); + return; + } + delete ds; + //set the file back to the beginning + file.reset(); + ds = new TQDataStream(&file); + TDEIO::NetAccess::removeTempFile(tmpFile); + } else { + KMessageBox::error(this, TDEIO::NetAccess::lastErrorString()); + return; + } + } else { + e->ignore(); + return; + } + TQt::ButtonState state = kapp->keyboardMouseState(); + if (isEntry) { + if (!item) { + e->ignore(); + 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; + } + TQString 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 tdewalletmanager and Control is not pressed + if (ok && el && !(state & TQt::ControlButton) && 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 tdewalletmanager and Control is not pressed + if (ok && el && !(state & TQt::ControlButton) && 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 TQString& name) { + for (TQListViewItem *vi = firstChild(); vi; vi = vi->nextSibling()) { + KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(vi); + if (!fi) { + continue; + } + if (name == fi->name()) { + return true; + } + } + return false; +} + +void KWalletEntryList::contentsDropEvent(TQDropEvent *e) { + TQListViewItem *i = itemAt(contentsToViewport(e->pos())); + itemDropped(e, i); +} + +void KWalletEntryList::contentsDragEnterEvent(TQDragEnterEvent *e) { + if (e->provides("application/x-tdewallet-entry") || + e->provides("application/x-tdewallet-folder") || + e->provides("application/uri-list")) { + e->accept(); + } else { + e->ignore(); + } +} + +KWalletFolderItem* KWalletEntryList::getFolder(const TQString& name) { + for (TQListViewItem *vi = firstChild(); vi; vi = vi->nextSibling()) { + KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(vi); + if (!fi) { + continue; + } + if (name == fi->name()) { + return fi; + } + } + return 0; +} + +KWalletFolderItem *KWalletEntryList::getItemFolder(TQListViewItem *item) { + switch (item->rtti()) { + 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; +} + +/**************** + * KWalletIconDrag - Stores the data for wallet drags + */ +class KWalletIconDrag : public TQIconDrag { + public: + KWalletIconDrag(TQWidget *dragSource, const char *name = 0L) + : TQIconDrag(dragSource, name) { + } + + virtual ~KWalletIconDrag() {} + + virtual const char *format(int i = 0) const { + if (i == 0) { + return "application/x-qiconlist"; + } else if (i == 1) { + return "text/uri-list"; + } + return 0L; + } + + TQByteArray encodedData(const char *mime) const { + TQByteArray a; + TQCString mimetype(mime); + if (mimetype == "application/x-qiconlist") { + return TQIconDrag::encodedData(mime); + } else if (mimetype == "text/uri-list") { + TQCString s = _urls.join("\r\n").latin1(); + if (_urls.count() > 0) { + s.append("\r\n"); + } + a.resize(s.length() + 1); + memcpy(a.data(), s.data(), s.length() + 1); + } + return a; + } + + void append(const TQIconDragItem &item, const TQRect &pr, + const TQRect &tr, const TQString &url) { + TQIconDrag::append(item, pr, tr); + _urls.append(url); + } + + private: + TQStringList _urls; +}; + +/**************** +* * KWalletIconView - An iconview to store wallets +* */ +KWalletIconView::KWalletIconView(TQWidget *parent, const char *name) +: KIconView(parent, name) { + TDEGlobal::dirs()->addResourceType("tdewallet", "share/apps/tdewallet"); + connect(this, TQT_SIGNAL(dropped(TQDropEvent*, const TQValueList<TQIconDragItem>&)), TQT_SLOT(slotDropped(TQDropEvent*, const TQValueList<TQIconDragItem>&))); +} + +KWalletIconView::~KWalletIconView() { +} + +void KWalletIconView::slotDropped(TQDropEvent *e, const TQValueList<TQIconDragItem>& /*lst*/) { + if (e->source() == viewport()) { + e->ignore(); + return; + } + + if (!e->provides("text/uri-list")) { + e->ignore(); + return; + } + + TQByteArray edata = e->encodedData("text/uri-list"); + TQCString urls = edata.data(); + + TQStringList ul = TQStringList::split("\r\n", urls); + if (ul.isEmpty() || ul.first().isEmpty()) { + e->ignore(); + return; + } + + KURL u(ul.first()); + + if (u.fileName().isEmpty()) { + e->ignore(); + return; + } + + TQString dest = TDEGlobal::dirs()->saveLocation("tdewallet") + u.fileName(); + if (TQFile::exists(dest)) { + KMessageBox::sorry(viewport(), i18n("That wallet file already exists. You cannot overwrite wallets.")); + e->ignore(); + return; + } + + // FIXME: verify that it is a real wallet file first + TDEIO::NetAccess::file_copy(u, KURL::fromPathOrURL(dest)); + e->accept(); +} + +void KWalletIconView::contentsMousePressEvent(TQMouseEvent *e) { + _mousePos = e->pos(); + if (!findItem(_mousePos)) { + clearSelection(); + } + KIconView::contentsMousePressEvent( e ); +} + +TQDragObject *KWalletIconView::dragObject() { + KWalletIconDrag* id = new KWalletIconDrag(viewport(), "KWallet Drag"); + TQString path = "file:" + TDEGlobal::dirs()->saveLocation("tdewallet"); + TQPoint pos = _mousePos; + for (TQIconViewItem *item = firstItem(); item; item = item->nextItem()) { + if (item->isSelected()) { + TQString url = path + item->text() + ".kwl"; + TQIconDragItem idi; + idi.setData(url.local8Bit()); + id->append(idi, + TQRect(item->pixmapRect(false).topLeft() - pos, + item->pixmapRect(false).size()), + TQRect(item->textRect(false).topLeft() - pos, + item->textRect(false).size()), + url); + } + } + + id->setPixmap(*currentItem()->pixmap(), + pos - currentItem()->pixmapRect(false).topLeft()); + + return id; +} + +TQDragObject *KWalletEntryList::dragObject() { + TQListViewItem *i = currentItem(); + + TQStoredDrag *sd = 0L; + + if (i->rtti() == KWalletEntryItemClass) { + KWalletEntryItem *ei = dynamic_cast<KWalletEntryItem*>(i); + if (!ei) { + return 0L; + } + sd = new KWalletEntryDrag(viewport(), "KWallet Entry Drag"); + TQByteArray a; + TQDataStream ds(a, IO_WriteOnly); + ds << KWALLETENTRYMAGIC; + ds << *ei; + sd->setEncodedData(a); + } else if (i->rtti() == KWalletFolderItemClass) { + KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem*>(i); + if (!fi) { + return 0L; + } + sd = new KWalletFolderDrag(viewport(), "KWallet Folder Drag"); + TQByteArray a; + TQDataStream ds(a, IO_WriteOnly); + + ds << KWALLETFOLDERMAGIC; + ds << *fi; + sd->setEncodedData(a); + } + return sd; +} + +#include "allyourbase.moc" diff --git a/tdewallet/allyourbase.h b/tdewallet/allyourbase.h new file mode 100644 index 0000000..fe9bd05 --- /dev/null +++ b/tdewallet/allyourbase.h @@ -0,0 +1,180 @@ +/* + Copyright (C) 2003-2005 George Staikos <[email protected]> + Copyright (C) 2005 Isaac Clerencia <[email protected]> + + 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 <kiconview.h> +#include <klistview.h> +#include <tdewallet.h> +#include <kiconloader.h> +#include <kicontheme.h> + +#define KWALLETENTRYMAGIC ((TQ_UINT32) 0x6B776C65) +#define KWALLETFOLDERMAGIC ((TQ_UINT32) 0x6B776C66) + +enum KWalletListItemClasses { + KWalletFolderItemClass = 1000, + KWalletContainerItemClass, + KWalletEntryItemClass, + KWalletUnknownClass = 2000 +}; + +class KWalletEntryItem : public KListViewItem { + public: + KWalletEntryItem(KWallet::Wallet *w, TQListViewItem* parent, const TQString& ename); + virtual ~KWalletEntryItem(); + + const TQString& oldName() { return _oldName; } + TQString currentName() { return text(0); } + + void clearOldName() { _oldName = text(0); } + virtual int rtti() const; + + public: + KWallet::Wallet *_wallet; + + private: + TQString _oldName; +}; + +class KWalletContainerItem : public KListViewItem { + public: + KWalletContainerItem(TQListViewItem* parent, const TQString& name, + KWallet::Wallet::EntryType type); + virtual ~KWalletContainerItem(); + + public: + virtual int rtti() const; + KWallet::Wallet::EntryType type(); + bool contains(const TQString& itemKey); + TQListViewItem* getItem(const TQString& itemKey); + + private: + KWallet::Wallet::EntryType _type; +}; + +class KWalletFolderItem : public KListViewItem { + public: + KWalletFolderItem(KWallet::Wallet *w, TQListView* parent, + const TQString& name, int entries); + virtual ~KWalletFolderItem(); + + virtual bool acceptDrop(const TQMimeSource *mime) const; + virtual int rtti() const; + + TQString name() const; + void refresh(); + KWalletContainerItem* getContainer(KWallet::Wallet::EntryType type); + TQPixmap getFolderIcon(KIcon::Group group); + bool contains(const TQString& itemKey); + TQListViewItem* getItem(const TQString& itemKey); + + public: + KWallet::Wallet *_wallet; + + private: + TQString _name; + int _entries; +}; + +class KWalletEntryList : public KListView { + Q_OBJECT + + public: + KWalletEntryList(TQWidget *parent, const char *name = 0L); + virtual ~KWalletEntryList(); + + bool existsFolder(const TQString& name); + KWalletFolderItem* getFolder(const TQString& name); + void contentsDropEvent(TQDropEvent *e); + void contentsDragEnterEvent(TQDragEnterEvent *e); + void setWallet(KWallet::Wallet *w); + + protected: + void itemDropped(TQDropEvent *e, TQListViewItem *item); + virtual TQDragObject *dragObject(); + virtual bool acceptDrag (TQDropEvent* event) const; + + private: + static KWalletFolderItem *getItemFolder(TQListViewItem *item); + + public: + KWallet::Wallet *_wallet; +}; + +class KWalletItem : public TQIconViewItem { + public: + KWalletItem(TQIconView *parent, const TQString& walletName); + virtual ~KWalletItem(); + + virtual bool acceptDrop(const TQMimeSource *mime) const; + + protected: + virtual void dropped(TQDropEvent *e, const TQValueList<TQIconDragItem>& lst); +}; + + +class KWalletIconView : public KIconView { + Q_OBJECT + + public: + KWalletIconView(TQWidget *parent, const char *name = 0L); + virtual ~KWalletIconView(); + + protected slots: + virtual void slotDropped(TQDropEvent *e, const TQValueList<TQIconDragItem>& lst); + + protected: + virtual TQDragObject *dragObject(); + virtual void contentsMousePressEvent(TQMouseEvent *e); + TQPoint _mousePos; +}; + + +inline TQDataStream& operator<<(TQDataStream& str, const KWalletEntryItem& w) { + TQString name = w.text(0); + str << name; + KWallet::Wallet::EntryType et = w._wallet->entryType(name); + str << long(et); + TQByteArray a; + w._wallet->readEntry(name, a); + str << a; + return str; +} + +inline TQDataStream& operator<<(TQDataStream& str, const KWalletFolderItem& w) { + TQString oldFolder = w._wallet->currentFolder(); + str << w.name(); + w._wallet->setFolder(w.name()); + TQStringList entries = w._wallet->entryList(); + for (TQStringList::Iterator it = entries.begin(); it != entries.end(); ++it) { + str << *it; + KWallet::Wallet::EntryType et = w._wallet->entryType(*it); + str << long(et); + TQByteArray a; + w._wallet->readEntry(*it, a); + str << a; + } + w._wallet->setFolder(oldFolder); + return str; +} + +#endif diff --git a/tdewallet/hi128-app-tdewalletmanager.png b/tdewallet/hi128-app-tdewalletmanager.png Binary files differnew file mode 100644 index 0000000..ccdd7c9 --- /dev/null +++ b/tdewallet/hi128-app-tdewalletmanager.png diff --git a/tdewallet/hi128-app-tdewalletmanager2.png b/tdewallet/hi128-app-tdewalletmanager2.png Binary files differnew file mode 100644 index 0000000..e3937db --- /dev/null +++ b/tdewallet/hi128-app-tdewalletmanager2.png diff --git a/tdewallet/hi16-app-tdewalletmanager.png b/tdewallet/hi16-app-tdewalletmanager.png Binary files differnew file mode 100644 index 0000000..4f9f4fd --- /dev/null +++ b/tdewallet/hi16-app-tdewalletmanager.png diff --git a/tdewallet/hi16-app-tdewalletmanager2.png b/tdewallet/hi16-app-tdewalletmanager2.png Binary files differnew file mode 100644 index 0000000..b2f9004 --- /dev/null +++ b/tdewallet/hi16-app-tdewalletmanager2.png diff --git a/tdewallet/hi22-app-tdewalletmanager.png b/tdewallet/hi22-app-tdewalletmanager.png Binary files differnew file mode 100644 index 0000000..8bc4cdb --- /dev/null +++ b/tdewallet/hi22-app-tdewalletmanager.png diff --git a/tdewallet/hi32-app-tdewalletmanager.png b/tdewallet/hi32-app-tdewalletmanager.png Binary files differnew file mode 100644 index 0000000..69a7c1e --- /dev/null +++ b/tdewallet/hi32-app-tdewalletmanager.png diff --git a/tdewallet/hi32-app-tdewalletmanager2.png b/tdewallet/hi32-app-tdewalletmanager2.png Binary files differnew file mode 100644 index 0000000..3cfc4e2 --- /dev/null +++ b/tdewallet/hi32-app-tdewalletmanager2.png diff --git a/tdewallet/hi48-app-tdewalletmanager.png b/tdewallet/hi48-app-tdewalletmanager.png Binary files differnew file mode 100644 index 0000000..5b46a87 --- /dev/null +++ b/tdewallet/hi48-app-tdewalletmanager.png diff --git a/tdewallet/hi48-app-tdewalletmanager2.png b/tdewallet/hi48-app-tdewalletmanager2.png Binary files differnew file mode 100644 index 0000000..3ae286d --- /dev/null +++ b/tdewallet/hi48-app-tdewalletmanager2.png diff --git a/tdewallet/hi64-app-tdewalletmanager.png b/tdewallet/hi64-app-tdewalletmanager.png Binary files differnew file mode 100644 index 0000000..38a581c --- /dev/null +++ b/tdewallet/hi64-app-tdewalletmanager.png diff --git a/tdewallet/hi64-app-tdewalletmanager2.png b/tdewallet/hi64-app-tdewalletmanager2.png Binary files differnew file mode 100644 index 0000000..2e5be4b --- /dev/null +++ b/tdewallet/hi64-app-tdewalletmanager2.png diff --git a/tdewallet/icons/CMakeLists.txt b/tdewallet/icons/CMakeLists.txt new file mode 100644 index 0000000..68f67e2 --- /dev/null +++ b/tdewallet/icons/CMakeLists.txt @@ -0,0 +1,16 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +tde_install_icons( tdewalletmanager) + +tde_install_icons( + DESTINATION ${DATA_INSTALL_DIR}/tdewalletmanager/icons +) diff --git a/tdewallet/icons/Makefile.am b/tdewallet/icons/Makefile.am new file mode 100644 index 0000000..65d4236 --- /dev/null +++ b/tdewallet/icons/Makefile.am @@ -0,0 +1,5 @@ +KDE_ICON = tdewalletmanager + +pics_ICON = AUTO +picsdir = $(kde_datadir)/tdewalletmanager/icons + diff --git a/tdewallet/icons/cr22-action-folder_closed.png b/tdewallet/icons/cr22-action-folder_closed.png Binary files differnew file mode 100644 index 0000000..e3ebad3 --- /dev/null +++ b/tdewallet/icons/cr22-action-folder_closed.png diff --git a/tdewallet/icons/cr22-action-folder_open.png b/tdewallet/icons/cr22-action-folder_open.png Binary files differnew file mode 100644 index 0000000..ea175b7 --- /dev/null +++ b/tdewallet/icons/cr22-action-folder_open.png diff --git a/tdewallet/icons/cr22-action-wallet_closed.png b/tdewallet/icons/cr22-action-wallet_closed.png Binary files differnew file mode 100644 index 0000000..57558ac --- /dev/null +++ b/tdewallet/icons/cr22-action-wallet_closed.png diff --git a/tdewallet/icons/cr22-action-wallet_open.png b/tdewallet/icons/cr22-action-wallet_open.png Binary files differnew file mode 100644 index 0000000..55a447f --- /dev/null +++ b/tdewallet/icons/cr22-action-wallet_open.png diff --git a/tdewallet/kbetterthankdialogbase.ui b/tdewallet/kbetterthankdialogbase.ui new file mode 100644 index 0000000..65d8b5a --- /dev/null +++ b/tdewallet/kbetterthankdialogbase.ui @@ -0,0 +1,154 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>KBetterThanKDialogBase</class> +<widget class="TQDialog"> + <property name="name"> + <cstring>KBetterThanKDialogBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>479</width> + <height>109</height> + </rect> + </property> + <property name="caption"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="resizeMode"> + <enum>Fixed</enum> + </property> + <widget class="KActiveLabel" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>_label</cstring> + </property> + </widget> + <spacer row="1" column="2"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>41</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>_allowOnce</cstring> + </property> + <property name="text"> + <string>&Replace</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>_allowAlways</cstring> + </property> + <property name="text"> + <string>Replace &All</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>_deny</cstring> + </property> + <property name="text"> + <string>&Skip</string> + </property> + </widget> + <widget class="TQPushButton"> + <property name="name"> + <cstring>_denyForever</cstring> + </property> + <property name="text"> + <string>Skip A&ll</string> + </property> + </widget> + </hbox> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>21</height> + </size> + </property> + </spacer> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>_allowOnce</sender> + <signal>clicked()</signal> + <receiver>KBetterThanKDialogBase</receiver> + <slot>clicked()</slot> + </connection> + <connection> + <sender>_allowAlways</sender> + <signal>clicked()</signal> + <receiver>KBetterThanKDialogBase</receiver> + <slot>clicked()</slot> + </connection> + <connection> + <sender>_deny</sender> + <signal>clicked()</signal> + <receiver>KBetterThanKDialogBase</receiver> + <slot>clicked()</slot> + </connection> + <connection> + <sender>_denyForever</sender> + <signal>clicked()</signal> + <receiver>KBetterThanKDialogBase</receiver> + <slot>clicked()</slot> + </connection> +</connections> +<includes> + <include location="global" impldecl="in declaration">kactivelabel.h</include> + <include location="local" impldecl="in implementation">kbetterthankdialogbase.ui.h</include> +</includes> +<Q_SLOTS> + <slot access="private">clicked()</slot> + <slot>setLabel( const TQString & label )</slot> + <slot access="private">init()</slot> + <slot access="protected">accept()</slot> + <slot access="protected">reject()</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kactivelabel.h</includehint> +</includehints> +</UI> diff --git a/tdewallet/kbetterthankdialogbase.ui.h b/tdewallet/kbetterthankdialogbase.ui.h new file mode 100644 index 0000000..e97ffd1 --- /dev/null +++ b/tdewallet/kbetterthankdialogbase.ui.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you want to add, delete, or rename functions or slots, use +** TQt Designer to update this file, preserving your code. +** +** You should not define a constructor or destructor in this file. +** Instead, write your code in functions called init() and destroy(). +** These will automatically be called by the form's constructor and +** destructor. +*****************************************************************************/ + + +void KBetterThanKDialogBase::clicked() +{ + if (sender() == _allowOnce) { + done(3); + } else if (sender() == _allowAlways) { + done(1); + } else if (sender() == _deny) { + done(4); + } else if (sender() == _denyForever) { + done(2); + } +} + + +void KBetterThanKDialogBase::setLabel( const TQString & label ) +{ + _label->setText(label); +} + + +void KBetterThanKDialogBase::init() +{ + _allowOnce->setFocus(); +} + + +void KBetterThanKDialogBase::accept() +{ + setResult(3); +} + + +void KBetterThanKDialogBase::reject() +{ + TQDialog::reject(); + setResult(4); +} diff --git a/tdewallet/konfigurator/CMakeLists.txt b/tdewallet/konfigurator/CMakeLists.txt new file mode 100644 index 0000000..d9283f8 --- /dev/null +++ b/tdewallet/konfigurator/CMakeLists.txt @@ -0,0 +1,45 @@ +################################################# +# +# (C) 2012 Golubev Alexander +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### kcm_tdewallet (kpart) ####################### + +tde_add_kpart( kcm_tdewallet AUTOMOC + SOURCES walletconfigwidget.ui konfigurator.cpp + LINK tdeui-shared tdewalletclient-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### other data ################################ + +install( FILES tdewalletconfig.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) + +install( + FILES + tdewallet_config.desktop + tdewalletmanager_show.desktop + DESTINATION ${SERVICES_INSTALL_DIR} +) diff --git a/tdewallet/konfigurator/Makefile.am b/tdewallet/konfigurator/Makefile.am new file mode 100644 index 0000000..b7fa556 --- /dev/null +++ b/tdewallet/konfigurator/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +kde_module_LTLIBRARIES = kcm_tdewallet.la +kcm_tdewallet_la_SOURCES = walletconfigwidget.ui konfigurator.cpp +kcm_tdewallet_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kcm_tdewallet_la_LIBADD = $(LIB_TDEUI) -ltdewalletclient + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmtdewallet.pot + +xdg_apps_DATA = tdewalletconfig.desktop + +kde_services_DATA = tdewallet_config.desktop tdewalletmanager_show.desktop + diff --git a/tdewallet/konfigurator/konfigurator.cpp b/tdewallet/konfigurator/konfigurator.cpp new file mode 100644 index 0000000..230b4c9 --- /dev/null +++ b/tdewallet/konfigurator/konfigurator.cpp @@ -0,0 +1,323 @@ +/* + Copyright (C) 2003 George Staikos <[email protected]> + + 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 "walletconfigwidget.h" +#include <dcopclient.h> +#include <dcopref.h> +#include <kaboutdata.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kdialog.h> +#include <kgenericfactory.h> +#include <kinputdialog.h> +#include <kpopupmenu.h> +#include <tdewallet.h> + +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqlayout.h> +#include <tqlistview.h> +#include <tqpushbutton.h> +#include <tqspinbox.h> + +typedef KGenericFactory<KWalletConfig, TQWidget> KWalletFactory; +K_EXPORT_COMPONENT_FACTORY(kcm_tdewallet, KWalletFactory("kcmtdewallet")) + +KWalletConfig::KWalletConfig(TQWidget *parent, const char *name, const TQStringList&) +: TDECModule(KWalletFactory::instance(), parent, name) { + + TDEAboutData *about = + new TDEAboutData(I18N_NOOP("kcmtdewallet"), + I18N_NOOP("TDE Wallet Control Module"), + 0, 0, TDEAboutData::License_GPL, + I18N_NOOP("(c) 2003 George Staikos")); + about->addAuthor("George Staikos", 0, "[email protected]"); + setAboutData( about ); + + _cfg = new TDEConfig("tdewalletrc", false, false); + + TQVBoxLayout *vbox = new TQVBoxLayout(this, 0, KDialog::spacingHint()); + vbox->add(_wcw = new WalletConfigWidget(this)); + + connect(_wcw->_enabled, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_launchManager, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_autocloseManager, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_autoclose, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_closeIdle, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_openPrompt, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_screensaverLock, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_localWalletSelected, TQT_SIGNAL(clicked()), this, TQT_SLOT(configChanged())); + connect(_wcw->_idleTime, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(configChanged())); + connect(_wcw->_launch, TQT_SIGNAL(clicked()), this, TQT_SLOT(launchManager())); + connect(_wcw->_newWallet, TQT_SIGNAL(clicked()), this, TQT_SLOT(newNetworkWallet())); + connect(_wcw->_newLocalWallet, TQT_SIGNAL(clicked()), this, TQT_SLOT(newLocalWallet())); + connect(_wcw->_localWallet, TQT_SIGNAL(activated(int)), this, TQT_SLOT(configChanged())); + connect(_wcw->_defaultWallet, TQT_SIGNAL(activated(int)), this, TQT_SLOT(configChanged())); + connect(_wcw->_accessList, TQT_SIGNAL(contextMenuRequested(TQListViewItem*, const TQPoint&, int)), this, TQT_SLOT(contextMenuRequested(TQListViewItem*, const TQPoint&, int))); + + _wcw->_accessList->setAllColumnsShowFocus(true); + updateWalletLists(); + load(); + + if (DCOPClient::mainClient()->isApplicationRegistered("tdewalletmanager")) { + _wcw->_launch->hide(); + } + +} + + +KWalletConfig::~KWalletConfig() { + delete _cfg; + _cfg = 0L; +} + + +void KWalletConfig::updateWalletLists() { + TQString p1, p2; + p1 = _wcw->_localWallet->currentText(); + p2 = _wcw->_defaultWallet->currentText(); + + _wcw->_localWallet->clear(); + _wcw->_defaultWallet->clear(); + + TQStringList wl = KWallet::Wallet::walletList(); + _wcw->_localWallet->insertStringList(wl); + _wcw->_defaultWallet->insertStringList(wl); + + if (wl.contains(p1)) { + _wcw->_localWallet->setCurrentText(p1); + } + + if (wl.contains(p2)) { + _wcw->_defaultWallet->setCurrentText(p2); + } +} + + +TQString KWalletConfig::newWallet() { + bool ok; + + TQString n = KInputDialog::getText(i18n("New Wallet"), + i18n("Please choose a name for the new wallet:"), + TQString(), + &ok, + this); + + if (!ok) { + return TQString(); + } + + KWallet::Wallet *w = KWallet::Wallet::openWallet(n); + if (!w) { + return TQString(); + } + + delete w; + return n; +} + + +void KWalletConfig::newLocalWallet() { + TQString n = newWallet(); + if (n.isEmpty()) { + return; + } + + updateWalletLists(); + + _wcw->_localWallet->setCurrentText(n); + + emit changed(true); +} + + +void KWalletConfig::newNetworkWallet() { + TQString n = newWallet(); + if (n.isEmpty()) { + return; + } + + updateWalletLists(); + + _wcw->_defaultWallet->setCurrentText(n); + + emit changed(true); +} + + +void KWalletConfig::launchManager() { + if (!DCOPClient::mainClient()->isApplicationRegistered("tdewalletmanager")) { + TDEApplication::startServiceByDesktopName("tdewalletmanager_show"); + } else { + DCOPRef r("tdewalletmanager", "tdewalletmanager-mainwindow#1"); + r.send("show"); + r.send("raise"); + } +} + + +void KWalletConfig::configChanged() { + emit changed(true); +} + +void KWalletConfig::load() { + load( false ); +} + +void KWalletConfig::load(bool useDefaults) { + TDEConfigGroup config(_cfg, "Wallet"); + config.setReadDefaults( useDefaults ); + _wcw->_enabled->setChecked(config.readBoolEntry("Enabled", true)); + _wcw->_openPrompt->setChecked(config.readBoolEntry("Prompt on Open", true)); + _wcw->_launchManager->setChecked(config.readBoolEntry("Launch Manager", true)); + _wcw->_autocloseManager->setChecked(! config.readBoolEntry("Leave Manager Open", false)); + _wcw->_screensaverLock->setChecked(config.readBoolEntry("Close on Screensaver", false)); + _wcw->_autoclose->setChecked(!config.readBoolEntry("Leave Open", false)); + _wcw->_closeIdle->setChecked(config.readBoolEntry("Close When Idle", false)); + _wcw->_idleTime->setValue(config.readNumEntry("Idle Timeout", 10)); + if (config.hasKey("Default Wallet")) { + _wcw->_defaultWallet->setCurrentText(config.readEntry("Default Wallet")); + } else { + _wcw->_defaultWallet->setCurrentItem(0); + } + if (config.hasKey("Local Wallet")) { + _wcw->_localWalletSelected->setChecked( !config.readBoolEntry("Use One Wallet") ); + _wcw->_localWallet->setCurrentText(config.readEntry("Local Wallet")); + } else { + _wcw->_localWalletSelected->setChecked(false); + } + _wcw->_accessList->clear(); + _cfg->setGroup("Auto Deny"); + TQStringList denykeys = _cfg->entryMap("Auto Deny").keys(); + _cfg->setGroup("Auto Allow"); + TQStringList keys = _cfg->entryMap("Auto Allow").keys(); + for (TQStringList::Iterator i = keys.begin(); i != keys.end(); ++i) { + _cfg->setGroup("Auto Allow"); + TQStringList apps = _cfg->readListEntry(*i); + _cfg->setGroup("Auto Deny"); + TQStringList denyapps = _cfg->readListEntry(*i); + denykeys.remove(*i); + TQListViewItem *lvi = new TQListViewItem(_wcw->_accessList, *i); + for (TQStringList::Iterator j = apps.begin(); j != apps.end(); ++j) { + new TQListViewItem(lvi, TQString(), *j, i18n("Always Allow")); + } + for (TQStringList::Iterator j = denyapps.begin(); j != denyapps.end(); ++j) { + new TQListViewItem(lvi, TQString(), *j, i18n("Always Deny")); + } + } + _cfg->setGroup("Auto Deny"); + for (TQStringList::Iterator i = denykeys.begin(); i != denykeys.end(); ++i) { + TQStringList denyapps = _cfg->readListEntry(*i); + TQListViewItem *lvi = new TQListViewItem(_wcw->_accessList, *i); + for (TQStringList::Iterator j = denyapps.begin(); j != denyapps.end(); ++j) { + new TQListViewItem(lvi, TQString(), *j, i18n("Always Deny")); + } + } + emit changed(useDefaults); +} + + +void KWalletConfig::save() { + TDEConfigGroup 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->currentItem() != -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"); + _cfg->setGroup("Auto Allow"); + for (TQListViewItem *i = _wcw->_accessList->firstChild(); i; i = i->nextSibling()) { + TQStringList al; + for (TQListViewItem *j = i->firstChild(); j; j = j->nextSibling()) { + if (j->text(2) == i18n("Always Allow")) { + al << j->text(1); + } + } + _cfg->writeEntry(i->text(0), al); + } + + _cfg->setGroup("Auto Deny"); + for (TQListViewItem *i = _wcw->_accessList->firstChild(); i; i = i->nextSibling()) { + TQStringList al; + for (TQListViewItem *j = i->firstChild(); j; j = j->nextSibling()) { + if (j->text(2) == i18n("Always Deny")) { + al << j->text(1); + } + } + _cfg->writeEntry(i->text(0), al); + } + + _cfg->sync(); + DCOPRef("kded", "tdewalletd").call("reconfigure()"); + + emit changed(false); +} + + +void KWalletConfig::defaults() { + load( true ); +} + + +TQString KWalletConfig::quickHelp() const { + return i18n("This configuration module allows you to configure the KDE wallet system."); +} + + +void KWalletConfig::contextMenuRequested(TQListViewItem *item, const TQPoint& pos, int col) { + Q_UNUSED(col) + if (item && item->parent()) { + KPopupMenu *m = new KPopupMenu(this); + m->insertTitle(item->parent()->text(0)); + m->insertItem(i18n("&Delete"), this, TQT_SLOT(deleteEntry()), Key_Delete); + m->popup(pos); + } +} + + +void KWalletConfig::deleteEntry() { + TQListViewItem *item = _wcw->_accessList->selectedItem(); + if (item) { + delete item; + emit changed(true); + } +} + +#include "konfigurator.moc" + diff --git a/tdewallet/konfigurator/konfigurator.h b/tdewallet/konfigurator/konfigurator.h new file mode 100644 index 0000000..418d2e5 --- /dev/null +++ b/tdewallet/konfigurator/konfigurator.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2003 George Staikos <[email protected]> + + 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 <tdecmodule.h> + +class TDEConfig; +class WalletConfigWidget; +class TQListViewItem; + +class KWalletConfig : public TDECModule { + Q_OBJECT + + public: + KWalletConfig(TQWidget *parent = 0L, const char *name = 0L, const TQStringList& = TQStringList()); + virtual ~KWalletConfig(); + + void load(); + void load( bool useDefaults ); + void save(); + void defaults(); + + TQString quickHelp() const; + + public slots: + void configChanged(); + void launchManager(); + void newLocalWallet(); + void newNetworkWallet(); + void updateWalletLists(); + TQString newWallet(); + void deleteEntry(); + void contextMenuRequested(TQListViewItem *item, const TQPoint& pos, int col); + + private: + WalletConfigWidget *_wcw; + TDEConfig *_cfg; +}; + +#endif diff --git a/tdewallet/konfigurator/tdewallet_config.desktop b/tdewallet/konfigurator/tdewallet_config.desktop new file mode 100644 index 0000000..a30297b --- /dev/null +++ b/tdewallet/konfigurator/tdewallet_config.desktop @@ -0,0 +1,47 @@ +[Desktop Entry] +Type=Service +Exec=kcmshell --caption %c tdewalletconfig +Icon=tdewalletmanager +DocPath=tdewallet/index.html +Name=TDE Wallet +Name[ar]=محفظة كدى +Name[bg]=Портфейл +Name[br]=Doug-paperoù TDE +Name[bs]=TDE novčanik +Name[cs]=Úschovna TDE +Name[cy]=Waled TDE +Name[da]=TDE's tegnebog +Name[de]=Digitale Brieftasche +Name[el]=Πορτοφόλι του TDE +Name[es]=Cartera de TDE +Name[et]=TDE turvalaegas +Name[eu]=TDE Kartera +Name[fi]=Lompakko +Name[fr]=Gestionnaire de comptes de TDE +Name[hi]=केडीई वॉलेट +Name[hu]=Digitális noteszek +Name[is]=TDE veskið +Name[it]=Portafogli di TDE +Name[ja]=TDE ウォレット +Name[kk]=TDE әмияні +Name[km]=កាបូប TDE +Name[lt]=TDE slaptažodinės +Name[mk]=TDE Паричник +Name[nds]=TDE-Knipp +Name[ne]=TDE वालेट +Name[pa]=TDE ਵਾਲਿਟ +Name[pl]=Portfel TDE +Name[pt]=Carteira TDE +Name[pt_BR]=Carteira do TDE +Name[ro]=Portofel TDE +Name[ru]=Бумажник +Name[sl]=Listnica za TDE +Name[sv]=TDE-plånbok +Name[ta]= கேடிஇ வாலட் +Name[tg]=TDE Ҳамён +Name[tr]=TDE Cüzdan +Name[uk]=Торбинки TDE +Name[uz]=TDE qopchiq +Name[uz@cyrillic]=TDE қопчиқ +Name[zh_CN]=TDE 钱包 +Name[zh_TW]=TDE 錢包 diff --git a/tdewallet/konfigurator/tdewalletconfig.desktop b/tdewallet/konfigurator/tdewalletconfig.desktop new file mode 100644 index 0000000..ccae543 --- /dev/null +++ b/tdewallet/konfigurator/tdewalletconfig.desktop @@ -0,0 +1,152 @@ +[Desktop Entry] +Icon=tdewalletmanager +Type=Application +Exec=kcmshell tdewalletconfig +DocPath=tdewallet/index.html +X-TDE-ModuleType=Library +X-TDE-Library=tdewallet +X-TDE-ParentApp=kcontrol + +Name=TDE Wallet +Name[ar]=محفظة كدى +Name[bg]=Портфейл +Name[br]=Doug-paperoù TDE +Name[bs]=TDE novčanik +Name[cs]=Úschovna TDE +Name[cy]=Waled TDE +Name[da]=TDE's tegnebog +Name[de]=Digitale Brieftasche +Name[el]=Πορτοφόλι του TDE +Name[es]=Cartera de TDE +Name[et]=TDE turvalaegas +Name[eu]=TDE Kartera +Name[fi]=Lompakko +Name[fr]=Gestionnaire de comptes de TDE +Name[hi]=केडीई वॉलेट +Name[hu]=Digitális noteszek +Name[is]=TDE veskið +Name[it]=Portafogli di TDE +Name[ja]=TDE ウォレット +Name[kk]=TDE әмияні +Name[km]=កាបូប TDE +Name[lt]=TDE slaptažodinės +Name[mk]=TDE Паричник +Name[nds]=TDE-Knipp +Name[ne]=TDE वालेट +Name[pa]=TDE ਵਾਲਿਟ +Name[pl]=Portfel TDE +Name[pt]=Carteira TDE +Name[pt_BR]=Carteira do TDE +Name[ro]=Portofel TDE +Name[ru]=Бумажник +Name[sl]=Listnica za TDE +Name[sv]=TDE-plånbok +Name[ta]= கேடிஇ வாலட் +Name[tg]=TDE Ҳамён +Name[tr]=TDE Cüzdan +Name[uk]=Торбинки TDE +Name[uz]=TDE qopchiq +Name[uz@cyrillic]=TDE қопчиқ +Name[zh_CN]=TDE 钱包 +Name[zh_TW]=TDE 錢包 +Comment=TDE Wallet Configuration +Comment[ar]=إعداد محفظة كدى +Comment[bg]=Настройване на системата Портфейл +Comment[br]=Kefluniadur Doug-paperoù TDE +Comment[bs]=Podešavanje TDE novčanika +Comment[ca]=Configuració de carteres TDE +Comment[cs]=Nastavení úschovny TDE +Comment[cy]=Ffurfweddiad Waled TDE +Comment[da]=TDE's indstilling af tegnebog +Comment[de]=Einrichten der "digitalen Brieftasche" (KWallet) +Comment[el]=Ρύθμιση του πορτοφολιού του TDE +Comment[es]=Configuración de la cartera de TDE +Comment[et]=TDE turvalaeka seadistamine +Comment[eu]=TDE Karteraren Konfigurazioa +Comment[fa]=TDE Wallet پیکربندی +Comment[fi]=TDE-lompakon asetukset +Comment[fr]=Configuration du gestionnaire de comptes de TDE +Comment[ga]=Cumraíocht TDE Wallet +Comment[he]=TDE Wallet הגדרות +Comment[hi]=केडीई वॉलेट कॉन्फ़िगरेशन +Comment[hu]=A TDE digitális noteszeinek beállításai +Comment[is]=Stillingar veskisins +Comment[it]=Configurazione portafogli di TDE +Comment[ja]=TDE ウォレットの設定 +Comment[ka]=TDE Wallet-ის კონფიგურაცია +Comment[kk]=TDE әмияннің баптауы +Comment[km]=ការកំណត់រចនាសម្ព័ន្ធកាបូប TDE +Comment[lt]=TDE slaptažodinių konfigūravimas +Comment[mk]=Конфигурација на паричник во TDE +Comment[nb]=Oppsett av TDE Wallet +Comment[nds]=TDE-Knipp instellen +Comment[ne]=TDE वालेट कन्फिगरेसन +Comment[nl]=TDE portefeuille-instellingen +Comment[nn]=Oppsett av TDE Wallet +Comment[pa]=TDE ਵਾਲਿਟ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja Portfela TDE +Comment[pt]=Configuração da Carteira do TDE +Comment[pt_BR]=Configuração da Carteira do TDE +Comment[ro]=Configurează portofelul TDE +Comment[ru]=Параметры бумажника +Comment[sk]=Konfigurácia TDE Wallet +Comment[sl]=Nastavitve Listnice za TDE +Comment[sr]=Подешавање TDE Wallet-а +Comment[sr@Latn]=Podešavanje TDE Wallet-a +Comment[sv]=Inställning av TDE-plånbok +Comment[ta]=கேடிஇ வாலட் வடிவமைப்பு +Comment[tg]=TDE Танзими Ҳамён +Comment[tr]=TDE Cüzdan Ayarı +Comment[uk]=Налаштування KWallet +Comment[uz]=TDE qopchiq xizmatini moslash +Comment[uz@cyrillic]=TDE қопчиқ хизматини мослаш +Comment[zh_CN]=TDE 钱包配置 +Comment[zh_TW]=TDE 錢包設定 +Keywords=Wallet,Form Fill,Passwords,Form Data +Keywords[ar]=محفظة،ملأ نموذج،كلمات السرّ،بيانات نموذج +Keywords[bg]=портфейл, форми, форма, попълване, данни, парола, пароли, Wallet, Form Fill, Passwords, Form Data +Keywords[bs]=Wallet,Form Fill,Passwords,Form Data,novčanik,formulari,popunjavanje formulara,šifre +Keywords[ca]=Cartera,Ompliment de formularis,Contrasentes,Dades de formularis +Keywords[cs]=úschovna,vyplnění formuláře,hesla,data formuláře +Keywords[cy]=Waled,Llenwi Ffurflen,Cyfrineiriau,Data Ffurflenni +Keywords[da]=Tegnebog,Formularudfyldning,Kodeord,Formular-data +Keywords[de]=Geheimfach,Formular,Passwort,Brieftasche,digitale Brieftasche +Keywords[el]=Πορτοφόλι,Συμπλήρωση φόρμας,Κωδικοί πρόσβασης,Δεδομένα φόρμας +Keywords[es]=Cartera,Rellenar formulario,Contraseña,Datos de formulario +Keywords[et]=Turvalaegas,Vormi täitmine,Paroolid,Vormiandmed +Keywords[eu]=Kartera,Formularioa Bete,Pasahitzak,Formulario Datuak +Keywords[fa]=Wallet، پر کردن برگه، اسم رمزها، دادۀ برگه +Keywords[fi]=Lompakko,Lomakkeen täyttö,Salasanat,Lomaketiedot +Keywords[fr]=gestionnaire de comptes,remplissage de formulaire,Mots de passe,Données de formulaire +Keywords[ga]=Wallet,Líonadh Foirmeacha,Focal Faire,Sonraí foirme +Keywords[hi]=बटुआ,फ़ॉर्म फिल,पासवर्ड,फ़ॉर्म डाटा +Keywords[hu]=digitális notesz,űrlapkitöltés,jelszavak,űrlapadatok +Keywords[it]=portafogli,wallet,riempimento moduli,moduli,form,password,dati moduli +Keywords[ja]=ウォレット,フォームフィル,パスワード,フォームデータ +Keywords[ka]=Wallet,ფორმის შევსება,პაროლები,ფორმათა მონაცემები +Keywords[km]=កាបូប,ការបំពេញសំណុំបែបបទ,ពាក្យសម្ងាត់,ទិន្នន័យសំណុំបែបបទ +Keywords[lt]=Wallet, slaptažodinė,Form Fill,Passwords,Form Data,formų pildymas,slaptažodžiai,formų duomenys +Keywords[mk]=Wallet,Form Fill,Passwords,Form Data, Паричник, формулар, лозинки +Keywords[nb]=Wallet,Skjemautfylling,Passord,Skjema +Keywords[nds]=Knipp,Formulor,Passwöör,Formulordaten +Keywords[ne]=वालेट,फारम भराइ,पासवर्ड,फारम डेटा +Keywords[nl]=Wallet,gegevens,portefeuille,wachtwoorden,veilig bewaren van wachtwoorden,invulgegevens,formulieren +Keywords[nn]=wallet,skjemautfylling,passord,skjema +Keywords[pa]=Wallet,Form Fill,ਗੁਪਤ-ਕੋਡ,ਫਾਰਮ ਡਾਟਾ +Keywords[pl]=portfel,wypełnianie formularzy,uzupełnianie formularzy, hasła, hasło,dane formularzy, formularze +Keywords[pt]=Carteira,Preenchimento de Formulários,Senhas,Dados do Formulário +Keywords[pt_BR]=carteira,preenchimento de formulário,senhas,dados de formulário +Keywords[ro]=portofel,completare formulare,parole,date formular,formular +Keywords[ru]=Wallet,Form Fill,Passwords,Form Data,Бумажник,Пароли,Формы +Keywords[sk]=wallet,formuláre,heslá,dáta z formulárov,schránka,peňaženka +Keywords[sl]=waller,denarnica,gesla,obrazec,podatki,geslo,listnica +Keywords[sr]=Wallet,Form Fill,Passwords,Form Data,лозинке,новчаник +Keywords[sr@Latn]=Wallet,Form Fill,Passwords,Form Data,lozinke,novčanik +Keywords[sv]=Plånbok,fyll i formulär,lösenord,formulärdata +Keywords[ta]=வாலட், படிவ நிரப்பு, கடவுச் சொற்கள், படிவ தகவல் +Keywords[tg]=Ҳамён,Пуркунии Варақа,Гузарвожаҳо,Варақаи Додаҳо +Keywords[tr]=Cüzdan,Form Doldur,Şifreler,Form Verisi +Keywords[uk]=Торбинка,Заповнення форм,Паролі,Дані форм +Keywords[zh_CN]=Wallet,Form Fill,Passwords,Form Data,钱包,填充表单,密码,表单数据 + +Categories=Qt;TDE;X-TDE-settings-security; diff --git a/tdewallet/konfigurator/tdewalletmanager_show.desktop b/tdewallet/konfigurator/tdewalletmanager_show.desktop new file mode 100644 index 0000000..3de02d0 --- /dev/null +++ b/tdewallet/konfigurator/tdewalletmanager_show.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Name=Wallet Management Tool +Name[ar]=أداة إدارة المحفظة +Name[bg]=Портфейл +Name[br]=Merour an doug-paperoù +Name[bs]=Alat za upravljanje novčanikom +Name[ca]=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]=Verwaltung für digitale Brieftasche +Name[el]=Εργαλείο διαχείρισης πορτοφολιού +Name[es]=Herramienta de gestión de cartera +Name[et]=Turvalaeka haldur +Name[eu]=Kartera Kudeatzeko Tresna +Name[fa]=ابزار مدیریت Wallet +Name[fi]=Lompakon hallintatyökalu +Name[fr]=Outil de gestion de comptes +Name[ga]=Uirlis Bhainisteoireachta Wallet +Name[he]=כלי לניהול הארנק של TDE +Name[hi]= बटुआ प्रबंधन औज़ार +Name[hu]=Kezelőprogram a TDE digitális noteszeihez +Name[is]=Tól til að stýra eiginleikum veskisins +Name[it]=Strumento per la gestione dei portafogli +Name[ja]=ウォレット管理ツール +Name[ka]=Wallet-ის მმართველი მოწყობილობა +Name[kk]=Әмиянін басқару құралы +Name[km]=ឧបករណ៍គ្រប់គ្រងកាបូប +Name[lt]=Spatažodinių tvarkymo įrankis +Name[mk]=Алатка за менаџирање на паричници +Name[nb]=Wallet administrasjonsverktøy +Name[nds]=Knipp-Pleger +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 da Carteira +Name[ro]=Administrare portofel +Name[ru]=Управление паролями +Name[sk]=Nástroj na správu KWallet +Name[sl]=Orodje za upravljanje z listnicami +Name[sr]=Алат за управљање новчаником +Name[sr@Latn]=Alat za upravljanje novčanikom +Name[sv]=Hanteringsverktyg för plånbok +Name[ta]=வாலட் மேலாண்மை கருவி +Name[tg]=Асбоби Идоракунии Ҳамён +Name[tr]=Cüzdan Yönetim Aracı +Name[uk]=Засіб керування торбинками +Name[uz]=Qopchiq boshqarish vositasi +Name[uz@cyrillic]=Қопчиқ бошқариш воситаси +Name[zh_CN]=钱包管理工具 +Name[zh_TW]=錢包管理工具 +Exec=tdewalletmanager --show %u +MimeType=application/x-kde-wallet +InitialPreference=6 +Icon=tdewalletmanager +Type=Service +X-TDE-StartupNotify=true diff --git a/tdewallet/konfigurator/walletconfigwidget.ui b/tdewallet/konfigurator/walletconfigwidget.ui new file mode 100644 index 0000000..5f51713 --- /dev/null +++ b/tdewallet/konfigurator/walletconfigwidget.ui @@ -0,0 +1,499 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>WalletConfigWidget</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>WalletConfigWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>585</width> + <height>450</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQTabWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Wallet Preferences</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>_enabled</cstring> + </property> + <property name="text"> + <string>&Enable the TDE wallet subsystem</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><p>The wallet subsytem allows a convenient and secure way to manage all your passwords. You can decide if you want to use this system with this option.</p></string> + </property> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>groupBox2</cstring> + </property> + <property name="title"> + <string>Close Wallet</string> + </property> + <property name="whatsThis" stdset="0"> + <string>It is best to close your wallets when you are not using them to prevent others from viewing or using them.</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>_closeIdle</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Close when unused for:</string> + </property> + <property name="whatsThis" stdset="0"> + <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> + </widget> + <widget class="TQSpinBox"> + <property name="name"> + <cstring>_idleTime</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix"> + <string> min</string> + </property> + <property name="maxValue"> + <number>999</number> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="lineStep"> + <number>5</number> + </property> + <property name="value"> + <number>10</number> + </property> + <property name="whatsThis" stdset="0"> + <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> + </widget> + <spacer> + <property name="name"> + <cstring>spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>_screensaverLock</cstring> + </property> + <property name="text"> + <string>Close when screensaver starts</string> + </property> + <property name="whatsThis" stdset="0"> + <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> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>_autoclose</cstring> + </property> + <property name="text"> + <string>Close when last application stops using it</string> + </property> + <property name="whatsThis" stdset="0"> + <string><p><b>Close wallet as soon as applications that use it have stopped.</b><br>Note that your wallets 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> + </widget> + </vbox> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>groupBox4</cstring> + </property> + <property name="title"> + <string>Automatic Wallet Selection</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Select wallet to use as default:</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="0"> + <property name="name"> + <cstring>_localWalletSelected</cstring> + </property> + <property name="text"> + <string>Different wallet for local passwords:</string> + </property> + </widget> + <widget class="TQComboBox" row="0" column="2"> + <property name="name"> + <cstring>_defaultWallet</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQComboBox" row="1" column="2"> + <property name="name"> + <cstring>_localWallet</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQPushButton" row="1" column="3"> + <property name="name"> + <cstring>_newLocalWallet</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>New...</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="3"> + <property name="name"> + <cstring>_newWallet</cstring> + </property> + <property name="text"> + <string>New...</string> + </property> + </widget> + </grid> + </widget> + <widget class="TQGroupBox"> + <property name="name"> + <cstring>groupBox3</cstring> + </property> + <property name="title"> + <string>Wallet Manager</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>_launchManager</cstring> + </property> + <property name="text"> + <string>Show manager in system tray</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="1"> + <property name="name"> + <cstring>_autocloseManager</cstring> + </property> + <property name="text"> + <string>Hide system tray icon when last wallet closes</string> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>16</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Access Control</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox" row="0" column="0"> + <property name="name"> + <cstring>_openPrompt</cstring> + </property> + <property name="text"> + <string>&Prompt when an application accesses an open wallet</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQListView" row="1" column="0"> + <column> + <property name="text"> + <string>Wallet</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + <property name="allColumnsShowFocus"> + <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> + <property name="name"> + <cstring>_accessList</cstring> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + </widget> + <widget class="TQPushButton" row="1" column="1"> + <property name="name"> + <cstring>_launch</cstring> + </property> + <property name="text"> + <string>&Launch Wallet Manager</string> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>369</width> + <height>21</height> + </size> + </property> + </spacer> + </grid> +</widget> +<connections> + <connection> + <sender>_localWalletSelected</sender> + <signal>toggled(bool)</signal> + <receiver>_newLocalWallet</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>_localWalletSelected</sender> + <signal>toggled(bool)</signal> + <receiver>_localWallet</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>_closeIdle</sender> + <signal>toggled(bool)</signal> + <receiver>_idleTime</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>_enabled</sender> + <signal>toggled(bool)</signal> + <receiver>groupBox2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>_enabled</sender> + <signal>toggled(bool)</signal> + <receiver>groupBox4</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>_enabled</sender> + <signal>toggled(bool)</signal> + <receiver>groupBox3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>_closeIdle</sender> + <signal>toggled(bool)</signal> + <receiver>_idleTime</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>_launchManager</sender> + <signal>toggled(bool)</signal> + <receiver>_autocloseManager</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>_enabled</tabstop> + <tabstop>_closeIdle</tabstop> + <tabstop>_idleTime</tabstop> + <tabstop>_screensaverLock</tabstop> + <tabstop>_autoclose</tabstop> + <tabstop>_defaultWallet</tabstop> + <tabstop>_newWallet</tabstop> + <tabstop>_localWalletSelected</tabstop> + <tabstop>_localWallet</tabstop> + <tabstop>_newLocalWallet</tabstop> + <tabstop>_launchManager</tabstop> + <tabstop>_autocloseManager</tabstop> + <tabstop>tabWidget2</tabstop> + <tabstop>_openPrompt</tabstop> + <tabstop>_accessList</tabstop> + <tabstop>_launch</tabstop> +</tabstops> +<Q_SLOTS> + <slot>_storeTogether_toggled(bool)</slot> +</Q_SLOTS> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/tdewallet/kwalletmanager-tdewalletd.desktop b/tdewallet/kwalletmanager-tdewalletd.desktop new file mode 100644 index 0000000..d4f9706 --- /dev/null +++ b/tdewallet/kwalletmanager-tdewalletd.desktop @@ -0,0 +1,60 @@ +[Desktop Entry] +Name=Wallet Management Tool +Name[ar]=أداة إدارة المحفظة +Name[bg]=Портфейл +Name[br]=Merour an doug-paperoù +Name[bs]=Alat za upravljanje novčanikom +Name[ca]=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]=Verwaltung für digitale Brieftasche +Name[el]=Εργαλείο διαχείρισης πορτοφολιού +Name[es]=Herramienta de gestión de cartera +Name[et]=Turvalaeka haldur +Name[eu]=Kartera Kudeatzeko Tresna +Name[fa]=ابزار مدیریت Wallet +Name[fi]=Lompakon hallintatyökalu +Name[fr]=Outil de gestion de comptes +Name[ga]=Uirlis Bhainisteoireachta Wallet +Name[he]=כלי לניהול הארנק של TDE +Name[hi]= बटुआ प्रबंधन औज़ार +Name[hu]=Kezelőprogram a TDE digitális noteszeihez +Name[is]=Tól til að stýra eiginleikum veskisins +Name[it]=Strumento per la gestione dei portafogli +Name[ja]=ウォレット管理ツール +Name[ka]=Wallet-ის მმართველი მოწყობილობა +Name[kk]=Әмиянін басқару құралы +Name[km]=ឧបករណ៍គ្រប់គ្រងកាបូប +Name[lt]=Spatažodinių tvarkymo įrankis +Name[mk]=Алатка за менаџирање на паричници +Name[nb]=Wallet administrasjonsverktøy +Name[nds]=Knipp-Pleger +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 da Carteira +Name[ro]=Administrare portofel +Name[ru]=Управление паролями +Name[sk]=Nástroj na správu KWallet +Name[sl]=Orodje za upravljanje z listnicami +Name[sr]=Алат за управљање новчаником +Name[sr@Latn]=Alat za upravljanje novčanikom +Name[sv]=Hanteringsverktyg för plånbok +Name[ta]=வாலட் மேலாண்மை கருவி +Name[tg]=Асбоби Идоракунии Ҳамён +Name[tr]=Cüzdan Yönetim Aracı +Name[uk]=Засіб керування торбинками +Name[uz]=Qopchiq boshqarish vositasi +Name[uz@cyrillic]=Қопчиқ бошқариш воситаси +Name[zh_CN]=钱包管理工具 +Name[zh_TW]=錢包管理工具 +Exec=tdewalletmanager --tdewalletd +Icon=tdewalletmanager +Type=Application +Terminal=false +X-TDE-StartupNotify=false +NoDisplay=true diff --git a/tdewallet/kwmapeditor.cpp b/tdewallet/kwmapeditor.cpp new file mode 100644 index 0000000..2a9e332 --- /dev/null +++ b/tdewallet/kwmapeditor.cpp @@ -0,0 +1,187 @@ +/* + Copyright (C) 2003,2004 George Staikos <[email protected]> + + 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 "kwmapeditor.h" + +#include <kaction.h> +#include <kdebug.h> +#include <klocale.h> +#include <kpopupmenu.h> +#include <kstdaction.h> +#include <twin.h> + +#include <tqapplication.h> +#include <tqclipboard.h> +#include <tqpushbutton.h> +#include <tqtextedit.h> + +KWMapEditor::KWMapEditor(TQMap<TQString,TQString>& map, TQWidget *parent, const char *name) +: TQTable(0, 3, parent, name), _map(map) { + _ac = new KActionCollection(this); + _copyAct = KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(copy()), _ac); + connect(this, TQT_SIGNAL(valueChanged(int,int)), this, TQT_SIGNAL(dirty())); + connect(this, TQT_SIGNAL(contextMenuRequested(int,int,const TQPoint&)), + this, TQT_SLOT(contextMenu(int,int,const TQPoint&))); + setSelectionMode(TQTable::NoSelection); + horizontalHeader()->setLabel(0, TQString()); + horizontalHeader()->setLabel(1, i18n("Key")); + horizontalHeader()->setLabel(2, i18n("Value")); + setColumnWidth(0, 20); // FIXME: this is arbitrary + reload(); +} + +void KWMapEditor::reload() { + unsigned row = 0; + + while ((row = numRows()) > _map.count()) { + removeRow(row - 1); + } + + if ((row = numRows()) < _map.count()) { + insertRows(row, _map.count() - row); + for (int x = row; x < numRows(); ++x) { + TQPushButton *b = new TQPushButton("X", this); + connect(b, TQT_SIGNAL(clicked()), this, TQT_SLOT(erase())); + setCellWidget(x, 0, b); + } + } + + row = 0; + for (TQMap<TQString,TQString>::Iterator it = _map.begin(); it != _map.end(); ++it) { + setText(row, 1, it.key()); + setText(row, 2, it.data()); + row++; + } +} + + +KWMapEditor::~KWMapEditor() { +} + + +void KWMapEditor::erase() { + const TQObject *o = TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender())); + for (int i = 0; i < numRows(); i++) { + if (TQT_BASE_OBJECT_CONST(cellWidget(i, 0)) == TQT_BASE_OBJECT_CONST(o)) { + removeRow(i); + break; + } + } + + emit dirty(); +} + + +void KWMapEditor::saveMap() { + _map.clear(); + + for (int i = 0; i < numRows(); i++) { + _map[text(i, 1)] = text(i, 2); + } +} + + +void KWMapEditor::addEntry() { + int x = numRows(); + insertRows(x, 1); + TQPushButton *b = new TQPushButton("X", this); + connect(b, TQT_SIGNAL(clicked()), this, TQT_SLOT(erase())); + setCellWidget(x, 0, b); + ensureCellVisible(x, 1); + setCurrentCell(x, 1); + emit dirty(); +} + + +void KWMapEditor::emitDirty() { + emit dirty(); +} + + +void KWMapEditor::contextMenu(int row, int col, const TQPoint& pos) { + _contextRow = row; + _contextCol = col; + KPopupMenu *m = new KPopupMenu(this); + m->insertItem(i18n("&New Entry"), this, TQT_SLOT(addEntry())); + _copyAct->plug(m); + m->popup(pos); +} + + +void KWMapEditor::copy() { + TQApplication::clipboard()->setText(text(_contextRow, 2)); +} + + +class InlineEditor : public TQTextEdit { + public: + InlineEditor(KWMapEditor *p, int row, int col) + : TQTextEdit(), _p(p), row(row), col(col) { + setWFlags(WStyle_NoBorder | WDestructiveClose); + KWin::setType(winId(), NET::Override); + connect(p, TQT_SIGNAL(destroyed()), TQT_SLOT(close())); + } + virtual ~InlineEditor() { if (!_p) return; _p->setText(row, col, text()); _p->emitDirty(); } + + protected: + virtual void focusOutEvent(TQFocusEvent* fe) { + if (fe->reason() == TQFocusEvent::Popup) { + TQWidget *focusW = tqApp->focusWidget(); + if (focusW && focusW == popup) { + return; + } + } + close(); + } + virtual void keyPressEvent(TQKeyEvent *e) { + if (e->key() == TQt::Key_Escape) { + e->accept(); + close(); + } else { + e->ignore(); + TQTextEdit::keyPressEvent(e); + } + } + virtual TQPopupMenu *createPopupMenu(const TQPoint &p) { + popup = TQTextEdit::createPopupMenu(p); + return popup; + } + TQGuardedPtr<KWMapEditor> _p; + int row, col; + TQGuardedPtr<TQPopupMenu> popup; +}; + + +TQWidget *KWMapEditor::beginEdit(int row, int col, bool replace) { + //kdDebug(2300) << "EDIT COLUMN " << col << endl; + if (col != 2) { + return TQTable::beginEdit(row, col, replace); + } + + TQRect geo = cellGeometry(row, col); + TQTextEdit *e = new InlineEditor(this, row, col); + e->setText(text(row, col)); + e->move(mapToGlobal(geo.topLeft())); + e->resize(geo.width() * 2, geo.height() * 3); + e->show(); + return e; +} + + +#include "kwmapeditor.moc" diff --git a/tdewallet/kwmapeditor.h b/tdewallet/kwmapeditor.h new file mode 100644 index 0000000..0fade7b --- /dev/null +++ b/tdewallet/kwmapeditor.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2003,2004 George Staikos <[email protected]> + + 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 KWMAPEDITOR_H +#define KWMAPEDITOR_H + +#include <tqmap.h> +#include <tqstring.h> +#include <tqtable.h> + +class KAction; +class KActionCollection; + +class KWMapEditor : public TQTable { + Q_OBJECT + + + public: + KWMapEditor(TQMap<TQString,TQString>& map, TQWidget *parent = 0, const char *name = 0); + virtual ~KWMapEditor(); + + public slots: + void reload(); + void saveMap(); + void erase(); + void contextMenu(int row, int col, const TQPoint& pos); + void addEntry(); + void emitDirty(); + + private slots: + void copy(); + + protected: + virtual TQWidget *beginEdit(int row, int col, bool replace); + + signals: + void dirty(); + + private: + TQMap<TQString,TQString>& _map; + int _contextRow, _contextCol; + KActionCollection *_ac; + KAction *_copyAct; +}; + +#endif diff --git a/tdewallet/main.cpp b/tdewallet/main.cpp new file mode 100644 index 0000000..2279783 --- /dev/null +++ b/tdewallet/main.cpp @@ -0,0 +1,100 @@ +/* + Copyright (C) 2003-2005 George Staikos <[email protected]> + + 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 <kaboutdata.h> +#include <kcmdlineargs.h> +#include <kdebug.h> +#include <kglobal.h> +#include <klocale.h> +#include <kmimetype.h> +#include <kstandarddirs.h> +#include <kuniqueapplication.h> + +#include <tqfile.h> +#include <tqfileinfo.h> + +#include "tdewalletmanager.h" + + +class MyApp : public KUniqueApplication { + public: + MyApp() : KUniqueApplication() { ref(); } + virtual ~MyApp() {} + + virtual int newInstance() { return 0; } +}; + +int main(int argc, char **argv) { + static KCmdLineOptions options[] = { + {"show", I18N_NOOP("Show window on startup"), 0}, + {"tdewalletd", I18N_NOOP("For use by tdewalletd only"), 0}, + {"+name", I18N_NOOP("A wallet name"), 0}, + KCmdLineLastOption + }; + + TDEAboutData about("tdewalletmanager", I18N_NOOP("TDE Wallet Manager"), "1.1", + I18N_NOOP("TDE Wallet Management Tool"), + TDEAboutData::License_GPL, + I18N_NOOP("(c) 2003,2004 George Staikos"), 0, + "http://www.kde.org/"); + + about.addAuthor("George Staikos", I18N_NOOP("Primary author and maintainer"), "[email protected]"); + about.addAuthor("Isaac Clerencia", I18N_NOOP("Developer"), "[email protected]"); + + TDECmdLineArgs::init(argc, argv, &about); + TDECmdLineArgs::addCmdLineOptions(options); + + if (!KUniqueApplication::start()) { + return 0; + } + + MyApp a; + + KWalletManager wm; + wm.setCaption(i18n("TDE Wallet Manager")); + + a.setMainWidget(&wm); + + TDEGlobal::dirs()->addResourceType("tdewallet", "share/apps/tdewallet"); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if (args->isSet("show")) { + wm.show(); + } + + if (args->isSet("tdewalletd")) { + wm.tdewalletdLaunch(); + } + + for (int i = 0; i < args->count(); ++i) { + TQString fn = TQFileInfo(args->arg(i)).absFilePath(); + KMimeType::Ptr ptr; + if (TQFile::exists(fn) && + (ptr = KMimeType::findByFileContent(fn)) && + ptr->is("application/x-kde-wallet")) { + wm.openWalletFile(fn); + } else { + wm.openWallet(args->arg(i)); + } + } + args->clear(); + return a.exec(); +} + diff --git a/tdewallet/tdewalleteditor.cpp b/tdewallet/tdewalleteditor.cpp new file mode 100644 index 0000000..f85294f --- /dev/null +++ b/tdewallet/tdewalleteditor.cpp @@ -0,0 +1,1143 @@ +/* + Copyright (C) 2003-2005 George Staikos <[email protected]> + Copyright (C) 2005 Isaac Clerencia <[email protected]> + + 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 "kbetterthankdialogbase.h" +#include "tdewalleteditor.h" +#include "kwmapeditor.h" +#include "allyourbase.h" + +#include <dcopclient.h> +#include <dcopref.h> +#include <kaction.h> +#include <kapplication.h> +#include <kdebug.h> +#include <kdialog.h> +#include <kfiledialog.h> +#include <kiconview.h> +#include <kinputdialog.h> +#include <kio/netaccess.h> +#include <klistviewsearchline.h> +#include <klocale.h> +#include <kmdcodec.h> +#include <kmessagebox.h> +#include <kpopupmenu.h> +#include <ksqueezedtextlabel.h> +#include <kstandarddirs.h> +#include <kstdaction.h> +#include <kstringhandler.h> +#include <ktempfile.h> + +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqclipboard.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqlineedit.h> +#include <tqlistview.h> +#include <tqptrstack.h> +#include <tqpushbutton.h> +#include <tqstylesheet.h> +#include <tqtextedit.h> +#include <tqtimer.h> +#include <tqwidgetstack.h> + +#include <assert.h> +#include <stdlib.h> + +KWalletEditor::KWalletEditor(const TQString& wallet, bool isPath, TQWidget *parent, const char *name) +: KMainWindow(parent, name), _walletName(wallet), _nonLocal(isPath) { + _newWallet = false; + _ww = new WalletWidget(this, "Wallet Widget"); + _copyPassAction = KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(copyPassword()), actionCollection()); + + TQVBoxLayout *box = new TQVBoxLayout(_ww->_entryListFrame); + box->setSpacing( KDialog::spacingHint() ); + box->setMargin( KDialog::marginHint() ); + _entryList = new KWalletEntryList(_ww->_entryListFrame, "Wallet Entry List"); + box->addWidget(new KListViewSearchLineWidget(_entryList, _ww->_entryListFrame)); + box->addWidget(_entryList); + + _ww->_entryStack->setEnabled(true); + + box = new TQVBoxLayout(_ww->_entryStack->widget(2)); + _mapEditorShowHide = new TQCheckBox(i18n("&Show values"), _ww->_entryStack->widget(2)); + connect(_mapEditorShowHide, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(showHideMapEditorValue(bool))); + _mapEditor = new KWMapEditor(_currentMap, _ww->_entryStack->widget(2)); + box->addWidget(_mapEditorShowHide); + box->addWidget(_mapEditor); + + setCentralWidget(_ww); + + resize(600, 400); + + connect(_entryList, TQT_SIGNAL(selectionChanged(TQListViewItem*)), + this, TQT_SLOT(entrySelectionChanged(TQListViewItem*))); + connect(_entryList, + TQT_SIGNAL(contextMenuRequested(TQListViewItem*,const TQPoint&,int)), + this, + TQT_SLOT(listContextMenuRequested(TQListViewItem*,const TQPoint&,int))); + connect(_entryList, + TQT_SIGNAL(itemRenamed(TQListViewItem*, int, const TQString&)), + this, + TQT_SLOT(listItemRenamed(TQListViewItem*, int, const TQString&))); + + connect(_ww->_passwordValue, TQT_SIGNAL(textChanged()), + this, TQT_SLOT(entryEditted())); + connect(_mapEditor, TQT_SIGNAL(dirty()), + this, TQT_SLOT(entryEditted())); + + connect(_ww->_undoChanges, TQT_SIGNAL(clicked()), + this, TQT_SLOT(restoreEntry())); + connect(_ww->_saveChanges, TQT_SIGNAL(clicked()), + this, TQT_SLOT(saveEntry())); + + connect(_ww->_showContents, TQT_SIGNAL(clicked()), + this, TQT_SLOT(showPasswordContents())); + connect(_ww->_hideContents, TQT_SIGNAL(clicked()), + this, TQT_SLOT(hidePasswordContents())); + + _walletIsOpen = false; + + _w = KWallet::Wallet::openWallet(wallet, winId(), isPath ? KWallet::Wallet::Path : KWallet::Wallet::Asynchronous); + if (_w) { + connect(_w, TQT_SIGNAL(walletOpened(bool)), this, TQT_SLOT(walletOpened(bool))); + connect(_w, TQT_SIGNAL(walletClosed()), this, TQT_SLOT(walletClosed())); + connect(_w, TQT_SIGNAL(folderUpdated(const TQString&)), this, TQT_SLOT(updateEntries(const TQString&))); + connect(_w, TQT_SIGNAL(folderListUpdated()), this, TQT_SLOT(updateFolderList())); + updateFolderList(); + } else { + kdDebug(2300) << "Wallet open failed!" << endl; + } + + createActions(); + createGUI("tdewalleteditor.rc"); + delete toolBar(); + + setCaption(wallet); + + TQTimer::singleShot(0, this, TQT_SLOT(layout())); +} + +KWalletEditor::~KWalletEditor() { + emit editorClosed(this); + delete _newFolderAction; + _newFolderAction = 0L; + delete _deleteFolderAction; + _deleteFolderAction = 0L; + delete _w; + _w = 0L; + if (_nonLocal) { + KWallet::Wallet::closeWallet(_walletName, true); + } +} + +void KWalletEditor::layout() { + TQValueList<int> sz = _ww->_splitter->sizes(); + int sum = sz[0] + sz[1]; + sz[0] = sum/2; + sz[1] = sum/2; + _ww->_splitter->setSizes(sz); +} + +void KWalletEditor::createActions() { + _newFolderAction = new KAction(i18n("&New Folder..."), "folder_new", + 0, TQT_TQOBJECT(this), TQT_SLOT(createFolder()), actionCollection(), + "create_folder"); + connect(this, TQT_SIGNAL(enableFolderActions(bool)), + _newFolderAction, TQT_SLOT(setEnabled(bool))); + + _deleteFolderAction = new KAction(i18n("&Delete Folder"), 0, 0, + TQT_TQOBJECT(this), TQT_SLOT(deleteFolder()), actionCollection(), + "delete_folder"); + connect(this, TQT_SIGNAL(enableContextFolderActions(bool)), + _deleteFolderAction, TQT_SLOT(setEnabled(bool))); + connect(this, TQT_SIGNAL(enableFolderActions(bool)), + _deleteFolderAction, TQT_SLOT(setEnabled(bool))); + + _passwordAction = new KAction(i18n("Change &Password..."), 0, 0, TQT_TQOBJECT(this), + TQT_SLOT(changePassword()), actionCollection(), + "change_password"); + connect(this, TQT_SIGNAL(enableWalletActions(bool)), + _passwordAction, TQT_SLOT(setEnabled(bool))); + + _mergeAction = new KAction(i18n("&Merge Wallet..."), 0, 0, TQT_TQOBJECT(this), + TQT_SLOT(importWallet()), actionCollection(), + "merge"); + connect(this, TQT_SIGNAL(enableWalletActions(bool)), + _mergeAction, TQT_SLOT(setEnabled(bool))); + + _importAction = new KAction(i18n("&Import XML..."), 0, 0, TQT_TQOBJECT(this), + TQT_SLOT(importXML()), actionCollection(), + "import"); + connect(this, TQT_SIGNAL(enableWalletActions(bool)), + _importAction, TQT_SLOT(setEnabled(bool))); + + _exportAction = new KAction(i18n("&Export..."), 0, 0, TQT_TQOBJECT(this), + TQT_SLOT(exportXML()), actionCollection(), + "export"); + connect(this, TQT_SIGNAL(enableWalletActions(bool)), + _exportAction, TQT_SLOT(setEnabled(bool))); + + _saveAsAction = KStdAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(saveAs()), actionCollection()); + connect(this, TQT_SIGNAL(enableWalletActions(bool)), + _saveAsAction, TQT_SLOT(setEnabled(bool))); + + KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); + KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), +actionCollection()); + emit enableWalletActions(false); + emit enableFolderActions(false); + emit enableContextFolderActions(false); +} + + +void KWalletEditor::walletClosed() { + delete _w; + _walletIsOpen = false; + _w = 0L; + _ww->setEnabled(false); + emit enableWalletActions(false); + emit enableFolderActions(false); + KMessageBox::sorry(this, i18n("This wallet was forced closed. You must reopen it to continue working with it.")); + deleteLater(); +} + + +void KWalletEditor::updateFolderList(bool checkEntries) { + TQStringList fl = _w->folderList(); + TQPtrStack<TQListViewItem> trash; + + for (TQListViewItem *i = _entryList->firstChild(); i; i = i->nextSibling()) { + KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(i); + if (!fi) { + continue; + } + if (!fl.contains(fi->name())) { + trash.push(i); + } + } + + trash.setAutoDelete(true); + trash.clear(); + + for (TQStringList::Iterator i = fl.begin(); i != fl.end(); ++i) { + if (_entryList->existsFolder(*i)) { + if (checkEntries) { + updateEntries(*i); + } + continue; + } + + _w->setFolder(*i); + TQStringList entries = _w->entryList(); + KWalletFolderItem *item = new KWalletFolderItem(_w,_entryList, + *i, entries.count()); + + KWalletContainerItem *pi = new KWalletContainerItem(item, i18n("Passwords"),KWallet::Wallet::Password); + KWalletContainerItem *mi = new KWalletContainerItem(item, i18n("Maps"),KWallet::Wallet::Map); + KWalletContainerItem *bi = new KWalletContainerItem(item, i18n("Binary Data"),KWallet::Wallet::Stream); + KWalletContainerItem *ui = new KWalletContainerItem(item, i18n("Unknown"),KWallet::Wallet::Unknown); + + for (TQStringList::Iterator j = entries.begin(); j != entries.end(); ++j) { + switch (_w->entryType(*j)) { + case KWallet::Wallet::Password: + new KWalletEntryItem(_w, pi, *j); + break; + case KWallet::Wallet::Stream: + new KWalletEntryItem(_w, bi, *j); + break; + case KWallet::Wallet::Map: + new KWalletEntryItem(_w, mi, *j); + break; + case KWallet::Wallet::Unknown: + default: + new TQListViewItem(ui, *j); + break; + } + } + _entryList->setEnabled(true); + } + + //check if the current folder has been removed + if (!fl.contains(_currentFolder)) { + _currentFolder = ""; + _ww->_entryTitle->clear(); + _ww->_iconTitle->clear(); + } +} + +void KWalletEditor::deleteFolder() { + if (_w) { + TQListViewItem *i = _entryList->currentItem(); + if (i) { + KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(i); + if (!fi) { + return; + } + + int rc = KMessageBox::warningContinueCancel(this, i18n("Are you sure you wish to delete the folder '%1' from the wallet?").arg(fi->name()),"",KStdGuiItem::del()); + if (rc == KMessageBox::Continue) { + bool rc = _w->removeFolder(fi->name()); + if (!rc) { + KMessageBox::sorry(this, i18n("Error deleting folder.")); + return; + } + _currentFolder = ""; + _ww->_entryTitle->clear(); + _ww->_iconTitle->clear(); + updateFolderList(); + } + } + } +} + + +void KWalletEditor::createFolder() { + if (_w) { + TQString n; + bool ok; + + do { + n = KInputDialog::getText(i18n("New Folder"), + i18n("Please choose a name for the new folder:"), + TQString(), + &ok, + this); + + if (!ok) { + return; + } + + if (_entryList->existsFolder(n)) { + int rc = KMessageBox::questionYesNo(this, i18n("Sorry, that folder name is in use. Try again?"), TQString(), i18n("Try Again"), i18n("Do Not Try")); + if (rc == KMessageBox::Yes) { + continue; + } + n = TQString(); + } + break; + } while (true); + + _w->createFolder(n); + updateFolderList(); + } +} + + +void KWalletEditor::saveEntry() { + int rc = 1; + TQListViewItem *item = _entryList->currentItem(); + _ww->_saveChanges->setEnabled(false); + _ww->_undoChanges->setEnabled(false); + + if (item && _w && item->parent()) { + KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem*>(item->parent()); + if (ci) { + if (ci->type() == KWallet::Wallet::Password) { + rc = _w->writePassword(item->text(0), _ww->_passwordValue->text()); + } else if (ci->type() == KWallet::Wallet::Map) { + _mapEditor->saveMap(); + rc = _w->writeMap(item->text(0), _currentMap); + } else { + return; + } + + if (rc == 0) { + return; + } + } + } + + KMessageBox::sorry(this, i18n("Error saving entry. Error code: %1").arg(rc)); +} + + +void KWalletEditor::restoreEntry() { + entrySelectionChanged(_entryList->currentItem()); +} + + +void KWalletEditor::entryEditted() { + _ww->_saveChanges->setEnabled(true); + _ww->_undoChanges->setEnabled(true); +} + + +void KWalletEditor::entrySelectionChanged(TQListViewItem *item) { + KWalletContainerItem *ci = 0L; + KWalletFolderItem *fi = 0L; + + switch (item->rtti()) { + case KWalletEntryItemClass: + ci = dynamic_cast<KWalletContainerItem*>(item->parent()); + if (!ci) { + return; + } + fi = dynamic_cast<KWalletFolderItem*>(ci->parent()); + if (!fi) { + return; + } + _w->setFolder(fi->name()); + _deleteFolderAction->setEnabled(false); + if (ci->type() == KWallet::Wallet::Password) { + TQString pass; + if (_w->readPassword(item->text(0), pass) == 0) { + _ww->_entryStack->raiseWidget(int(4)); + _ww->_entryName->setText(i18n("Password: %1") + .arg(item->text(0))); + _ww->_passwordValue->setText(pass); + _ww->_saveChanges->setEnabled(false); + _ww->_undoChanges->setEnabled(false); + } + } else if (ci->type() == KWallet::Wallet::Map) { + _ww->_entryStack->raiseWidget(int(2)); + _mapEditorShowHide->setChecked(false); + showHideMapEditorValue(false); + if (_w->readMap(item->text(0), _currentMap) == 0) { + _mapEditor->reload(); + _ww->_entryName->setText(i18n("Name-Value Map: %1").arg(item->text(0))); + _ww->_saveChanges->setEnabled(false); + _ww->_undoChanges->setEnabled(false); + } + } else if (ci->type() == KWallet::Wallet::Stream) { + _ww->_entryStack->raiseWidget(int(3)); + TQByteArray ba; + if (_w->readEntry(item->text(0), ba) == 0) { + _ww->_entryName->setText(i18n("Binary Data: %1") + .arg(item->text(0))); + _ww->_saveChanges->setEnabled(false); + _ww->_undoChanges->setEnabled(false); + } + } + break; + + case KWalletContainerItemClass: + fi = dynamic_cast<KWalletFolderItem*>(item->parent()); + if (!fi) { + return; + } + _w->setFolder(fi->name()); + _deleteFolderAction->setEnabled(false); + _ww->_entryName->clear(); + _ww->_entryStack->raiseWidget(int(0)); + break; + + case KWalletFolderItemClass: + fi = dynamic_cast<KWalletFolderItem*>(item); + if (!fi) { + return; + } + _w->setFolder(fi->name()); + _deleteFolderAction->setEnabled(true); + _ww->_entryName->clear(); + _ww->_entryStack->raiseWidget(int(0)); + break; + } + + if (fi) { + _currentFolder = fi->name(); + _ww->_entryTitle->setText(TQString("<font size=\"+1\">%1</font>").arg(fi->text(0))); + _ww->_iconTitle->setPixmap(fi->getFolderIcon(KIcon::Toolbar)); + } +} + +void KWalletEditor::updateEntries(const TQString& folder) { + TQPtrStack<TQListViewItem> trash; + + _w->setFolder(folder); + TQStringList entries = _w->entryList(); + + KWalletFolderItem *fi = _entryList->getFolder(folder); + + if (!fi) { + return; + } + + KWalletContainerItem *pi = fi->getContainer(KWallet::Wallet::Password); + KWalletContainerItem *mi = fi->getContainer(KWallet::Wallet::Map); + KWalletContainerItem *bi = fi->getContainer(KWallet::Wallet::Stream); + KWalletContainerItem *ui = fi->getContainer(KWallet::Wallet::Unknown); + + // Remove deleted entries + for (TQListViewItem *i = pi->firstChild(); i; i = i->nextSibling()) { + if (!entries.contains(i->text(0))) { + if (i == _entryList->currentItem()) { + entrySelectionChanged(0L); + } + trash.push(i); + } + } + + for (TQListViewItem *i = mi->firstChild(); i; i = i->nextSibling()) { + if (!entries.contains(i->text(0))) { + if (i == _entryList->currentItem()) { + entrySelectionChanged(0L); + } + trash.push(i); + } + } + + for (TQListViewItem *i = bi->firstChild(); i; i = i->nextSibling()) { + if (!entries.contains(i->text(0))) { + if (i == _entryList->currentItem()) { + entrySelectionChanged(0L); + } + trash.push(i); + } + } + + for (TQListViewItem *i = ui->firstChild(); i; i = i->nextSibling()) { + if (!entries.contains(i->text(0))) { + if (i == _entryList->currentItem()) { + entrySelectionChanged(0L); + } + trash.push(i); + } + } + + trash.setAutoDelete(true); + trash.clear(); + + // Add new entries + for (TQStringList::Iterator i = entries.begin(); i != entries.end(); ++i) { + if (fi->contains(*i)){ + continue; + } + + switch (_w->entryType(*i)) { + case KWallet::Wallet::Password: + new KWalletEntryItem(_w, pi, *i); + break; + case KWallet::Wallet::Stream: + new KWalletEntryItem(_w, bi, *i); + break; + case KWallet::Wallet::Map: + new KWalletEntryItem(_w, mi, *i); + break; + case KWallet::Wallet::Unknown: + default: + new TQListViewItem(ui, *i); + break; + } + } + fi->refresh(); + if (fi->name() == _currentFolder) { + _ww->_entryTitle->setText(TQString("<font size=\"+1\">%1</font>").arg(fi->text(0))); + } + if (!_entryList->selectedItem()) { + _ww->_entryName->clear(); + _ww->_entryStack->raiseWidget(int(0)); + } +} + +void KWalletEditor::listContextMenuRequested(TQListViewItem *item, const TQPoint& pos, int col) { + Q_UNUSED(col) + + if (!_walletIsOpen) { + return; + } + + KWalletListItemClasses menuClass = KWalletUnknownClass; + KWalletContainerItem *ci = 0L; + + if (item) { + if (item->rtti() == KWalletEntryItemClass) { + ci = dynamic_cast<KWalletContainerItem *>(item->parent()); + if (!ci) { + return; + } + } else if (item->rtti() == KWalletContainerItemClass) { + ci = dynamic_cast<KWalletContainerItem *>(item); + if (!ci) { + return; + } + } + + if (ci && ci->type() == KWallet::Wallet::Unknown) { + return; + } + menuClass = static_cast<KWalletListItemClasses>(item->rtti()); + } + + KPopupMenu *m = new KPopupMenu(this); + if (item) { + TQString title = item->text(0); + // I think 200 pixels is wide enough for a title + title = KStringHandler::cPixelSqueeze(title, m->fontMetrics(), 200); + m->insertTitle(title); + switch (menuClass) { + case KWalletEntryItemClass: + m->insertItem(i18n("&New..." ), this, TQT_SLOT(newEntry()), Key_Insert); + m->insertItem(i18n( "&Rename" ), this, TQT_SLOT(renameEntry()), Key_F2); + m->insertItem(i18n( "&Delete" ), this, TQT_SLOT(deleteEntry()), Key_Delete); + if (ci && ci->type() == KWallet::Wallet::Password) { + m->insertSeparator(); + _copyPassAction->plug(m); + } + break; + + case KWalletContainerItemClass: + m->insertItem(i18n( "&New..." ), this, TQT_SLOT(newEntry()), Key_Insert); + break; + + case KWalletFolderItemClass: + _newFolderAction->plug(m); + _deleteFolderAction->plug(m); + break; + default: + abort(); + } + } else { + _newFolderAction->plug(m); + } + m->popup(pos); +} + + +void KWalletEditor::copyPassword() { + TQListViewItem *item = _entryList->selectedItem(); + if (_w && item) { + TQString pass; + if (_w->readPassword(item->text(0), pass) == 0) { + TQApplication::clipboard()->setText(pass); + } + } +} + + +void KWalletEditor::newEntry() { + TQListViewItem *item = _entryList->selectedItem(); + TQString n; + bool ok; + + TQListViewItem *p; + KWalletFolderItem *fi; + + //set the folder where we're trying to create the new entry + if (_w && item) { + p = item; + if (p->rtti() == KWalletEntryItemClass) { + p = item->parent(); + } + fi = dynamic_cast<KWalletFolderItem *>(p->parent()); + if (!fi) { + return; + } + _w->setFolder(fi->name()); + } else { + return; + } + + do { + n = KInputDialog::getText(i18n("New Entry"), + i18n("Please choose a name for the new entry:"), + TQString(), + &ok, + this); + + if (!ok) { + return; + } + + // FIXME: prohibits the use of the subheadings + if (fi->contains(n)) { + int rc = KMessageBox::questionYesNo(this, i18n("Sorry, that entry already exists. Try again?"), TQString(), i18n("Try Again"), i18n("Do Not Try")); + if (rc == KMessageBox::Yes) { + continue; + } + n = TQString(); + } + break; + } while (true); + + if (_w && item && !n.isEmpty()) { + TQListViewItem *p = item; + if (p->rtti() == KWalletEntryItemClass) { + p = item->parent(); + } + + KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(p->parent()); + if (!fi) { + KMessageBox::error(this, i18n("An unexpected error occurred trying to add the new entry")); + return; + } + _w->setFolder(fi->name()); + + KWalletEntryItem *ni = new KWalletEntryItem(_w, p, n); + _entryList->setSelected(ni,true); + _entryList->ensureItemVisible(ni); + + KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem*>(p); + if (!ci) { + KMessageBox::error(this, i18n("An unexpected error occurred trying to add the new entry")); + return; + } + if (ci->type() == KWallet::Wallet::Password) { + _w->writePassword(n, TQString()); + } else if (ci->type() == KWallet::Wallet::Map) { + _w->writeMap(n, TQMap<TQString,TQString>()); + } else if (ci->type() == KWallet::Wallet::Stream) { + _w->writeEntry(n, TQByteArray()); + } else { + abort(); + } + fi->refresh(); + _ww->_entryTitle->setText(TQString("<font size=\"+1\">%1</font>").arg(fi->text(0))); + } +} + + +void KWalletEditor::renameEntry() { + TQListViewItem *item = _entryList->selectedItem(); + if (_w && item) { + item->startRename(0); + } +} + + +// Only supports renaming of KWalletEntryItem derived classes. +void KWalletEditor::listItemRenamed(TQListViewItem* item, int, const TQString& t) { + if (item) { + KWalletEntryItem *i = dynamic_cast<KWalletEntryItem*>(item); + if (!i) { + return; + } + + if (!_w || t.isEmpty()) { + i->setText(0, i->oldName()); + return; + } + + if (_w->renameEntry(i->oldName(), t) == 0) { + i->clearOldName(); + KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem*>(item->parent()); + if (!ci) { + KMessageBox::error(this, i18n("An unexpected error occurred trying to rename the entry")); + return; + } + if (ci->type() == KWallet::Wallet::Password) { + _ww->_entryName->setText(i18n("Password: %1").arg(item->text(0))); + } else if (ci->type() == KWallet::Wallet::Map) { + _ww->_entryName->setText(i18n("Name-Value Map: %1").arg(item->text(0))); + } else if (ci->type() == KWallet::Wallet::Stream) { + _ww->_entryName->setText(i18n("Binary Data: %1").arg(item->text(0))); + } + } else { + i->setText(0, i->oldName()); + } + } +} + + +void KWalletEditor::deleteEntry() { + TQListViewItem *item = _entryList->selectedItem(); + if (_w && item) { + int rc = KMessageBox::warningContinueCancel(this, i18n("Are you sure you wish to delete the item '%1'?").arg(item->text(0)),"",KStdGuiItem::del()); + if (rc == KMessageBox::Continue) { + KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(item->parent()->parent()); + if (!fi) { + KMessageBox::error(this, i18n("An unexpected error occurred trying to delete the entry")); + return; + } + _w->removeEntry(item->text(0)); + delete item; + entrySelectionChanged(_entryList->currentItem()); + fi->refresh(); + _ww->_entryTitle->setText(TQString("<font size=\"+1\">%1</font>").arg(fi->text(0))); + } + } +} + +void KWalletEditor::changePassword() { + KWallet::Wallet::changePassword(_walletName); +} + + +void KWalletEditor::walletOpened(bool success) { + if (success) { + emit enableFolderActions(true); + emit enableContextFolderActions(false); + emit enableWalletActions(true); + updateFolderList(); + show(); + _entryList->setWallet(_w); + _walletIsOpen = true; + } else { + if (!_newWallet) { + KMessageBox::sorry(this, i18n("Unable to open the requested wallet.")); + } + close(); + } +} + + +void KWalletEditor::hidePasswordContents() { + _ww->_entryStack->raiseWidget(int(4)); +} + + +void KWalletEditor::showPasswordContents() { + _ww->_entryStack->raiseWidget(int(1)); +} + + +void KWalletEditor::showHideMapEditorValue(bool show) { + if (show) { + _mapEditor->showColumn(2); + } else { + _mapEditor->hideColumn(2); + } +} + + +enum MergePlan { Prompt = 0, Always = 1, Never = 2, Yes = 3, No = 4 }; + +void KWalletEditor::importWallet() { + KURL url = KFileDialog::getOpenURL(TQString(), "*.kwl", this); + if (url.isEmpty()) { + return; + } + + TQString tmpFile; + if (!TDEIO::NetAccess::download(url, tmpFile, this)) { + KMessageBox::sorry(this, i18n("Unable to access wallet '<b>%1</b>'.").arg(url.prettyURL())); + return; + } + + KWallet::Wallet *w = KWallet::Wallet::openWallet(tmpFile, winId(), KWallet::Wallet::Path); + if (w && w->isOpen()) { + MergePlan mp = Prompt; + TQStringList fl = w->folderList(); + for (TQStringList::ConstIterator f = fl.constBegin(); f != fl.constEnd(); ++f) { + if (!w->setFolder(*f)) { + continue; + } + + if (!_w->hasFolder(*f)) { + _w->createFolder(*f); + } + + _w->setFolder(*f); + + TQMap<TQString, TQMap<TQString, TQString> > map; + int rc; + rc = w->readMapList("*", map); + if (rc == 0) { + TQMap<TQString, TQMap<TQString, TQString> >::ConstIterator me; + for (me = map.constBegin(); me != map.constEnd(); ++me) { + bool hasEntry = _w->hasEntry(me.key()); + if (hasEntry && mp == Prompt) { + KBetterThanKDialogBase *bd; + bd = new KBetterThanKDialogBase(this); + bd->setLabel(i18n("Folder '<b>%1</b>' already contains an entry '<b>%2</b>'. Do you wish to replace it?").arg(TQStyleSheet::escape(*f)).arg(TQStyleSheet::escape(me.key()))); + mp = (MergePlan)bd->exec(); + delete bd; + bool ok = false; + if (mp == Always || mp == Yes) { + ok = true; + } + if (mp == Yes || mp == No) { + // reset mp + mp = Prompt; + } + if (!ok) { + continue; + } + } else if (hasEntry && mp == Never) { + continue; + } + _w->writeMap(me.key(), me.data()); + } + } + + TQMap<TQString, TQString> pwd; + rc = w->readPasswordList("*", pwd); + if (rc == 0) { + TQMap<TQString, TQString>::ConstIterator pe; + for (pe = pwd.constBegin(); pe != pwd.constEnd(); ++pe) { + bool hasEntry = _w->hasEntry(pe.key()); + if (hasEntry && mp == Prompt) { + KBetterThanKDialogBase *bd; + bd = new KBetterThanKDialogBase(this); + bd->setLabel(i18n("Folder '<b>%1</b>' already contains an entry '<b>%2</b>'. Do you wish to replace it?").arg(TQStyleSheet::escape(*f)).arg(TQStyleSheet::escape(pe.key()))); + mp = (MergePlan)bd->exec(); + delete bd; + bool ok = false; + if (mp == Always || mp == Yes) { + ok = true; + } + if (mp == Yes || mp == No) { + // reset mp + mp = Prompt; + } + if (!ok) { + continue; + } + } else if (hasEntry && mp == Never) { + continue; + } + _w->writePassword(pe.key(), pe.data()); + } + } + + TQMap<TQString, TQByteArray> ent; + rc = w->readEntryList("*", ent); + if (rc == 0) { + TQMap<TQString, TQByteArray>::ConstIterator ee; + for (ee = ent.constBegin(); ee != ent.constEnd(); ++ee) { + bool hasEntry = _w->hasEntry(ee.key()); + if (hasEntry && mp == Prompt) { + KBetterThanKDialogBase *bd; + bd = new KBetterThanKDialogBase(this); + bd->setLabel(i18n("Folder '<b>%1</b>' already contains an entry '<b>%2</b>'. Do you wish to replace it?").arg(TQStyleSheet::escape(*f)).arg(TQStyleSheet::escape(ee.key()))); + mp = (MergePlan)bd->exec(); + delete bd; + bool ok = false; + if (mp == Always || mp == Yes) { + ok = true; + } + if (mp == Yes || mp == No) { + // reset mp + mp = Prompt; + } + if (!ok) { + continue; + } + } else if (hasEntry && mp == Never) { + continue; + } + _w->writeEntry(ee.key(), ee.data()); + } + } + } + } + + delete w; + + TDEIO::NetAccess::removeTempFile(tmpFile); + updateFolderList(true); + restoreEntry(); +} + + +void KWalletEditor::importXML() { + KURL url = KFileDialog::getOpenURL(TQString(), "*.xml", this); + if (url.isEmpty()) { + return; + } + + TQString tmpFile; + if (!TDEIO::NetAccess::download(url, tmpFile, this)) { + KMessageBox::sorry(this, i18n("Unable to access XML file '<b>%1</b>'.").arg(url.prettyURL())); + return; + } + + TQFile qf(tmpFile); + if (!qf.open(IO_ReadOnly)) { + KMessageBox::sorry(this, i18n("Error opening XML file '<b>%1</b>' for input.").arg(url.prettyURL())); + TDEIO::NetAccess::removeTempFile(tmpFile); + return; + } + + TQDomDocument doc(tmpFile); + if (!doc.setContent(&qf)) { + KMessageBox::sorry(this, i18n("Error reading XML file '<b>%1</b>' for input.").arg(url.prettyURL())); + TDEIO::NetAccess::removeTempFile(tmpFile); + return; + } + + TQDomElement top = doc.documentElement(); + if (top.tagName().lower() != "wallet") { + KMessageBox::sorry(this, i18n("Error: XML file does not contain a wallet.")); + TDEIO::NetAccess::removeTempFile(tmpFile); + return; + } + + TQDomNode n = top.firstChild(); + MergePlan mp = Prompt; + while (!n.isNull()) { + TQDomElement e = n.toElement(); + if (e.tagName().lower() != "folder") { + n = n.nextSibling(); + continue; + } + + TQString fname = e.attribute("name"); + if (fname.isEmpty()) { + n = n.nextSibling(); + continue; + } + if (!_w->hasFolder(fname)) { + _w->createFolder(fname); + } + _w->setFolder(fname); + TQDomNode enode = e.firstChild(); + while (!enode.isNull()) { + e = enode.toElement(); + TQString type = e.tagName().lower(); + TQString ename = e.attribute("name"); + bool hasEntry = _w->hasEntry(ename); + if (hasEntry && mp == Prompt) { + KBetterThanKDialogBase *bd; + bd = new KBetterThanKDialogBase(this); + bd->setLabel(i18n("Folder '<b>%1</b>' already contains an entry '<b>%2</b>'. Do you wish to replace it?").arg(TQStyleSheet::escape(fname)).arg(TQStyleSheet::escape(ename))); + mp = (MergePlan)bd->exec(); + delete bd; + bool ok = false; + if (mp == Always || mp == Yes) { + ok = true; + } + if (mp == Yes || mp == No) { // reset mp + mp = Prompt; + } + if (!ok) { + enode = enode.nextSibling(); + continue; + } + } else if (hasEntry && mp == Never) { + enode = enode.nextSibling(); + continue; + } + + if (type == "password") { + _w->writePassword(ename, e.text()); + } else if (type == "stream") { + _w->writeEntry(ename, KCodecs::base64Decode(TQCString(e.text().latin1()))); + } else if (type == "map") { + TQMap<TQString,TQString> map; + TQDomNode mapNode = e.firstChild(); + while (!mapNode.isNull()) { + TQDomElement mape = mapNode.toElement(); + if (mape.tagName().lower() == "mapentry") { + map[mape.attribute("name")] = mape.text(); + } + mapNode = mapNode.nextSibling(); + } + _w->writeMap(ename, map); + } + enode = enode.nextSibling(); + } + n = n.nextSibling(); + } + + TDEIO::NetAccess::removeTempFile(tmpFile); + updateFolderList(true); + restoreEntry(); +} + + +void KWalletEditor::exportXML() { + KTempFile tf; + tf.setAutoDelete(true); + TQTextStream& ts(*tf.textStream()); + TQStringList fl = _w->folderList(); + + ts << "<wallet name=\"" << _walletName << "\">" << endl; + for (TQStringList::Iterator i = fl.begin(); i != fl.end(); ++i) { + ts << " <folder name=\"" << *i << "\">" << endl; + _w->setFolder(*i); + TQStringList entries = _w->entryList(); + for (TQStringList::Iterator j = entries.begin(); j != entries.end(); ++j) { + switch (_w->entryType(*j)) { + case KWallet::Wallet::Password: + { + TQString pass; + if (_w->readPassword(*j, pass) == 0) { + ts << " <password name=\"" << TQStyleSheet::escape(*j) << "\">"; + ts << TQStyleSheet::escape(pass); + ts << "</password>" << endl; + } + break; + } + case KWallet::Wallet::Stream: + { + TQByteArray ba; + if (_w->readEntry(*j, ba) == 0) { + ts << " <stream name=\"" << TQStyleSheet::escape(*j) << "\">"; + ts << KCodecs::base64Encode(ba); + + ts << "</stream>" << endl; + } + break; + } + case KWallet::Wallet::Map: + { + TQMap<TQString,TQString> map; + if (_w->readMap(*j, map) == 0) { + ts << " <map name=\"" << TQStyleSheet::escape(*j) << "\">" << endl; + for (TQMap<TQString,TQString>::ConstIterator k = map.begin(); k != map.end(); ++k) { + ts << " <mapentry name=\"" << TQStyleSheet::escape(k.key()) << "\">" << TQStyleSheet::escape(k.data()) << "</mapentry>" << endl; + } + ts << " </map>" << endl; + } + break; + } + case KWallet::Wallet::Unknown: + default: + break; + } + } + ts << " </folder>" << endl; + } + + ts << "</wallet>" << endl; + tf.close(); + + KURL url = KFileDialog::getSaveURL(TQString(), "*.xml", this); + + if (!url.isEmpty()) { + bool ok = true; + if (TDEIO::NetAccess::exists(url, false, this)) { + int rc = KMessageBox::warningContinueCancel(this, i18n("The file '%1' already exists. Would you like to overwrite this file?").arg(url.prettyURL()), i18n("Overwrite")); + if (rc == KMessageBox::Cancel) { + ok = false; + } + } + if (ok) { + KURL tfURL; tfURL.setPath(tf.name()); + TDEIO::NetAccess::file_copy(tfURL, url, 0600, true, false, this); + } + } +} + + +void KWalletEditor::setNewWallet(bool x) { + _newWallet = x; +} + + +void KWalletEditor::saveAs() { + KURL url = KFileDialog::getSaveURL(TQString(), "*.kwl", this); + if (!url.isEmpty()) { + // Sync() tdewalletd + if (_nonLocal) { + TDEIO::NetAccess::file_copy(KURL(_walletName), url, 0600, false, false, this); + } else { + TQString path = TDEGlobal::dirs()->saveLocation("tdewallet") + "/" + _walletName + ".kwl"; + KURL destURL; destURL.setPath(path); + TDEIO::NetAccess::file_copy(destURL, url, 0600, false, false, this); + } + } +} + + +#include "tdewalleteditor.moc" + diff --git a/tdewallet/tdewalleteditor.h b/tdewallet/tdewalleteditor.h new file mode 100644 index 0000000..fa7ea25 --- /dev/null +++ b/tdewallet/tdewalleteditor.h @@ -0,0 +1,111 @@ +/* + Copyright (C) 2003-2005 George Staikos <[email protected]> + Copyright (C) 2005 Isaac Clerencia <[email protected]> + + 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 KWALLETEDITOR_H +#define KWALLETEDITOR_H + +#include "walletwidget.h" +#include <tdewallet.h> +#include <kmainwindow.h> +#include <tqstringlist.h> + +class KAction; +class TQIconViewItem; +class TQListViewItem; +class TQCheckBox; +class KWalletFolderIconView; +class KWalletEntryList; +class KWMapEditor; + +class KWalletEditor : public KMainWindow { + Q_OBJECT + + + public: + KWalletEditor(const TQString& wallet, bool isPath, TQWidget *parent = 0, const char* name = 0); + virtual ~KWalletEditor(); + + bool isOpen() const { return _w != 0L; } + + void setNewWallet(bool newWallet); + + public slots: + void walletClosed(); + void createFolder(); + void deleteFolder(); + + private slots: + void layout(); + void updateFolderList(bool checkEntries = false); + void entrySelectionChanged(TQListViewItem *item); + void listItemRenamed(TQListViewItem *, int, const TQString&); + void listContextMenuRequested(TQListViewItem *item, const TQPoint& pos, int col); + void updateEntries(const TQString& folder); + + void newEntry(); + void renameEntry(); + void deleteEntry(); + void entryEditted(); + void restoreEntry(); + void saveEntry(); + + void changePassword(); + + void walletOpened(bool success); + void hidePasswordContents(); + void showPasswordContents(); + void showHideMapEditorValue(bool show); + + void saveAs(); + void exportXML(); + void importXML(); + void importWallet(); + + void copyPassword(); + + signals: + void enableWalletActions(bool enable); + void enableFolderActions(bool enable); + void enableContextFolderActions(bool enable); + void editorClosed(KMainWindow*); + + public: + TQString _walletName; + + private: + void createActions(); + bool _nonLocal; + KWallet::Wallet *_w; + WalletWidget *_ww; + KWalletEntryList *_entryList; + bool _walletIsOpen; + KAction *_newFolderAction, *_deleteFolderAction; + KAction *_passwordAction, *_exportAction, *_saveAsAction, *_mergeAction, *_importAction; + KAction *_copyPassAction; + TQLabel*_details; + TQString _currentFolder; + TQMap<TQString,TQString> _currentMap; // save memory by storing + // only the most recent map. + KWMapEditor *_mapEditor; + TQCheckBox *_mapEditorShowHide; + bool _newWallet; +}; + +#endif diff --git a/tdewallet/tdewalleteditor.rc b/tdewallet/tdewalleteditor.rc new file mode 100644 index 0000000..76bd319 --- /dev/null +++ b/tdewallet/tdewalleteditor.rc @@ -0,0 +1,17 @@ +<!DOCTYPE kpartgui> +<kpartgui name="tdewalleteditor" version="2"> + <MenuBar> + <Menu name="file"><text>&File</text> + <Action name="create_folder"/> + <Action name="delete_folder"/> + <Separator/> + <Action name="change_password"/> + <Separator/> + <Action name="merge"/> + <Action name="import"/> + <Action name="export"/> + </Menu> + <Menu name="help"><text>&Help</text> + </Menu> + </MenuBar> +</kpartgui> diff --git a/tdewallet/tdewalletmanager.cpp b/tdewallet/tdewalletmanager.cpp new file mode 100644 index 0000000..9e16b74 --- /dev/null +++ b/tdewallet/tdewalletmanager.cpp @@ -0,0 +1,423 @@ +/* + Copyright (C) 2003,2004 George Staikos <[email protected]> + + 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 "tdewalletmanager.h" +#include "tdewalletpopup.h" +#include "tdewalleteditor.h" +#include "allyourbase.h" + +#include <dcopclient.h> +#include <dcopref.h> +#include <kaction.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kiconloader.h> +#include <kiconview.h> +#include <kinputdialog.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kstandarddirs.h> +#include <kstdaction.h> +#include <ksystemtray.h> +#include <tdewallet.h> + +#include <tqaccel.h> +#include <tqguardedptr.h> +#include <tqptrstack.h> +#include <tqregexp.h> +#include <tqtimer.h> +#include <tqtooltip.h> + +KWalletManager::KWalletManager(TQWidget *parent, const char *name, WFlags f) +: KMainWindow(parent, name, f), DCOPObject("KWalletManager") { + TDEGlobal::dirs()->addResourceType("tdewallet", "share/apps/tdewallet"); + _tdewalletdLaunch = false; + TQAccel *accel = new TQAccel(this, "tdewalletmanager"); + + TDEApplication::dcopClient()->setQtBridgeEnabled(false); + _shuttingDown = false; + TDEConfig cfg("tdewalletrc"); // not sure why this setting isn't in tdewalletmanagerrc... + TDEConfigGroup walletConfigGroup(&cfg, "Wallet"); + _dcopRef = 0L; + if (walletConfigGroup.readBoolEntry("Launch Manager", true)) { + _tray = new KSystemTray(this, "tdewalletmanager tray"); + _tray->setPixmap(loadSystemTrayIcon("wallet_closed")); + TQToolTip::add(_tray, i18n("TDE Wallet: No wallets open.")); + connect(_tray, TQT_SIGNAL(quitSelected()), TQT_SLOT(shuttingDown())); + TQStringList wl = KWallet::Wallet::walletList(); + bool isOpen = false; + for (TQStringList::Iterator it = wl.begin(); it != wl.end(); ++it) { + if (KWallet::Wallet::isOpen(*it)) { + _tray->setPixmap(loadSystemTrayIcon("wallet_open")); + TQToolTip::remove(_tray); + TQToolTip::add(_tray, i18n("TDE Wallet: A wallet is open.")); + isOpen = true; + break; + } + } + if (!isOpen && kapp->isRestored()) { + delete _tray; + _tray = 0L; + TQTimer::singleShot( 0, kapp, TQT_SLOT( quit())); + return; + } + } else { + _tray = 0L; + } + + _iconView = new KWalletIconView(this, "tdewalletmanager icon view"); + connect(_iconView, TQT_SIGNAL(executed(TQIconViewItem*)), TQT_TQOBJECT(this), TQT_SLOT(openWallet(TQIconViewItem*))); + connect(_iconView, TQT_SIGNAL(contextMenuRequested(TQIconViewItem*, const TQPoint&)), TQT_TQOBJECT(this), TQT_SLOT(contextMenu(TQIconViewItem*, const TQPoint&))); + + updateWalletDisplay(); + setCentralWidget(_iconView); + _iconView->setMinimumSize(320, 200); + + _dcopRef = new DCOPRef("kded", "tdewalletd"); + _dcopRef->dcopClient()->setNotifications(true); + connect(_dcopRef->dcopClient(), + TQT_SIGNAL(applicationRemoved(const TQCString&)), + this, + TQT_SLOT(possiblyRescan(const TQCString&))); + connect(_dcopRef->dcopClient(), + TQT_SIGNAL(applicationRegistered(const TQCString&)), + this, + TQT_SLOT(possiblyRescan(const TQCString&))); + + connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "allWalletsClosed()", "allWalletsClosed()", false); + connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletClosed(TQString)", "updateWalletDisplay()", false); + connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletOpened(TQString)", "aWalletWasOpened()", false); + connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletDeleted(TQString)", "updateWalletDisplay()", false); + connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletListDirty()", "updateWalletDisplay()", false); + + // FIXME: slight race - a wallet can open, then we get launched, but the + // wallet closes before we are done opening. We will then stay + // open. Must check that a wallet is still open here. + + new KAction(i18n("&New Wallet..."), "tdewalletmanager", 0, TQT_TQOBJECT(this), + TQT_SLOT(createWallet()), actionCollection(), + "wallet_create"); + KAction *act = new KAction(i18n("Configure &Wallet..."), "configure", + 0, TQT_TQOBJECT(this), TQT_SLOT(setupWallet()), actionCollection(), + "wallet_settings"); + if (_tray) { + act->plug(_tray->contextMenu()); + } + act = new KAction(i18n("Close &All Wallets"), 0, 0, TQT_TQOBJECT(this), + TQT_SLOT(closeAllWallets()), actionCollection(), + "close_all_wallets"); + if (_tray) { + act->plug(_tray->contextMenu()); + } + KStdAction::quit(TQT_TQOBJECT(this), TQT_SLOT(shuttingDown()), actionCollection()); + KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), +actionCollection()); + + createGUI("tdewalletmanager.rc"); + accel->connectItem(accel->insertItem(Key_Return), TQT_TQOBJECT(this), TQT_SLOT(openWallet())); + accel->connectItem(accel->insertItem(Key_Delete), TQT_TQOBJECT(this), TQT_SLOT(deleteWallet())); + + if (_tray) { + _tray->show(); + } else { + show(); + } + + kapp->setName("tdewallet"); // hack to fix docs +} + + +KWalletManager::~KWalletManager() { + _tray = 0L; + delete _dcopRef; + _dcopRef = 0L; +} + + +void KWalletManager::tdewalletdLaunch() { + _tdewalletdLaunch = true; +} + + +bool KWalletManager::queryClose() { + if (!_shuttingDown && !kapp->sessionSaving()) { + if (!_tray) { + kapp->quit(); + } else { + hide(); + } + return false; + } + return true; +} + + +void KWalletManager::aWalletWasOpened() { + if (_tray) { + _tray->setPixmap(loadSystemTrayIcon("wallet_open")); + TQToolTip::remove(_tray); + TQToolTip::add(_tray, i18n("TDE Wallet: A wallet is open.")); + } + updateWalletDisplay(); +} + + +void KWalletManager::updateWalletDisplay() { +TQStringList wl = KWallet::Wallet::walletList(); +TQPtrStack<TQIconViewItem> trash; + + for (TQIconViewItem *item = _iconView->firstItem(); item; item = item->nextItem()) { + if (!wl.contains(item->text())) { + trash.push(item); + } + } + + trash.setAutoDelete(true); + trash.clear(); + + for (TQStringList::Iterator i = wl.begin(); i != wl.end(); ++i) { + if (!_iconView->findItem(*i)) { + // FIXME: if KWallet::Wallet::isOpen(*i) then show + // a different icon! + new KWalletItem(_iconView, *i); + } else { + // FIXME: See if icon needs to be updated + } + } +} + + +void KWalletManager::contextMenu(TQIconViewItem *item, const TQPoint& pos) { + if (item) { + TQGuardedPtr<KWalletPopup> popupMenu = new KWalletPopup(item->text(), this); + connect(popupMenu, TQT_SIGNAL(walletOpened(const TQString&)), TQT_TQOBJECT(this), TQT_SLOT(openWallet(const TQString&))); + connect(popupMenu, TQT_SIGNAL(walletClosed(const TQString&)), TQT_TQOBJECT(this), TQT_SLOT(closeWallet(const TQString&))); + connect(popupMenu, TQT_SIGNAL(walletDeleted(const TQString&)), TQT_TQOBJECT(this), TQT_SLOT(deleteWallet(const TQString&))); + connect(popupMenu, TQT_SIGNAL(walletChangePassword(const TQString&)), TQT_TQOBJECT(this), TQT_SLOT(changeWalletPassword(const TQString&))); + connect(popupMenu, TQT_SIGNAL(walletCreated()), TQT_TQOBJECT(this), TQT_SLOT(createWallet())); + popupMenu->exec(pos); + delete popupMenu; + } +} + + +void KWalletManager::deleteWallet(const TQString& walletName) { + int rc = KMessageBox::warningContinueCancel(this, i18n("Are you sure you wish to delete the wallet '%1'?").arg(walletName),"",KStdGuiItem::del()); + if (rc != KMessageBox::Continue) { + return; + } + rc = KWallet::Wallet::deleteWallet(walletName); + if (rc != 0) { + KMessageBox::sorry(this, i18n("Unable to delete the wallet. Error code was %1.").arg(rc)); + } + updateWalletDisplay(); +} + + +void KWalletManager::closeWallet(const TQString& walletName) { + int rc = KWallet::Wallet::closeWallet(walletName, false); + if (rc != 0) { + rc = KMessageBox::warningYesNo(this, i18n("Unable to close wallet cleanly. It is probably in use by other applications. Do you wish to force it closed?"), TQString(), i18n("Force Closure"), i18n("Do Not Force")); + if (rc == KMessageBox::Yes) { + rc = KWallet::Wallet::closeWallet(walletName, true); + if (rc != 0) { + KMessageBox::sorry(this, i18n("Unable to force the wallet closed. Error code was %1.").arg(rc)); + } + } + } + + updateWalletDisplay(); +} + + +void KWalletManager::changeWalletPassword(const TQString& walletName) { + KWallet::Wallet::changePassword(walletName); +} + + +void KWalletManager::openWalletFile(const TQString& path) { + KWalletEditor *we = new KWalletEditor(path, true, this, "Wallet Editor"); + if (we->isOpen()) { + connect(we, TQT_SIGNAL(editorClosed(KMainWindow*)), + this, TQT_SLOT(editorClosed(KMainWindow*))); + we->show(); + } else { + KMessageBox::sorry(this, i18n("Error opening wallet %1.").arg(path)); + delete we; + } +} + + +void KWalletManager::openWallet() { + TQIconViewItem *item = _iconView->currentItem(); + openWallet(item); +} + +void KWalletManager::deleteWallet() { + TQIconViewItem *item = _iconView->currentItem(); + if (item) { + deleteWallet(item->text()); + } +} + + +void KWalletManager::openWallet(const TQString& walletName) { + openWallet(walletName, false); +} + + +void KWalletManager::openWallet(const TQString& walletName, bool newWallet) { + // Don't allow a wallet to open in two windows + for (KMainWindow *w = _windows.first(); w; w = _windows.next()) { + KWalletEditor *e = static_cast<KWalletEditor*>(w); + if (e->isOpen() && e->_walletName == walletName) { + w->raise(); + return; + } + } + + KWalletEditor *we = new KWalletEditor(walletName, false, this, "Wallet Editor"); + we->setNewWallet(newWallet); + if (we->isOpen()) { + connect(we, TQT_SIGNAL(editorClosed(KMainWindow*)), + this, TQT_SLOT(editorClosed(KMainWindow*))); + we->show(); + _windows.append(we); + } else if (!newWallet) { + KMessageBox::sorry(this, i18n("Error opening wallet %1.").arg(walletName)); + delete we; + } +} + + +void KWalletManager::openWallet(TQIconViewItem *item) { + if (item) { + openWallet(item->text()); + } +} + + +void KWalletManager::allWalletsClosed() { + if (_tray) { + _tray->setPixmap(loadSystemTrayIcon("wallet_closed")); + TQToolTip::remove(_tray); + TQToolTip::add(_tray, i18n("TDE Wallet: No wallets open.")); + } + possiblyQuit(); +} + + +void KWalletManager::possiblyQuit() { + TDEConfig cfg("tdewalletrc"); + cfg.setGroup("Wallet"); + if (_windows.isEmpty() && + !isVisible() && + !cfg.readBoolEntry("Leave Manager Open", false) && + _tdewalletdLaunch) { + kapp->quit(); + } +} + + +void KWalletManager::editorClosed(KMainWindow* e) { + _windows.remove(e); +} + + +void KWalletManager::possiblyRescan(const TQCString& app) { + if (app == "kded") { + updateWalletDisplay(); + } +} + + +void KWalletManager::createWallet() { + TQString n; + bool ok; + // FIXME: support international names + TQRegExp regexp("^[A-Za-z0-9]+[A-Za-z0-9_\\s\\-]*$"); + TQString txt = i18n("Please choose a name for the new wallet:"); + + if (!KWallet::Wallet::isEnabled()) { + // FIXME: KMessageBox::warningYesNo(this, i1_8n("KWallet is not enabled. Do you want to enable it?"), TQString(), i18n("Enable"), i18n("Keep Disabled")); + return; + } + + do { + n = KInputDialog::getText(i18n("New Wallet"), + txt, + TQString(), + &ok, + this); + + if (!ok) { + return; + } + + if (_iconView->findItem(n)) { + int rc = KMessageBox::questionYesNo(this, i18n("Sorry, that wallet already exists. Try a new name?"), TQString(), i18n("Try New"), i18n("Do Not Try")); + if (rc == KMessageBox::Yes) { + continue; + } + n = TQString(); + } else if (regexp.exactMatch(n)) { + break; + } else { + txt = i18n("Please choose a name that contains only alphanumeric characters:"); + } + } while (true); + + // Small race here - the wallet could be created on us already. + if (!n.isEmpty()) { + openWallet(n, true); + } +} + + +void KWalletManager::shuttingDown() { + _shuttingDown = true; + kapp->quit(); +} + + +void KWalletManager::setupWallet() { + TDEApplication::startServiceByDesktopName("tdewallet_config"); +} + + +void KWalletManager::closeAllWallets() { + _dcopRef->call("closeAllWallets"); +} + + +TQPixmap KWalletManager::loadSystemTrayIcon(const TQString &icon) { +#if KDE_IS_VERSION(3, 1, 90) + return KSystemTray::loadIcon(icon); +#else + TDEConfig *appCfg = kapp->config(); + TDEConfigGroupSaver configSaver(appCfg, "System Tray"); + int iconWidth = appCfg->readNumEntry("systrayIconWidth", 22); + return kapp->iconLoader()->loadIcon( icon, KIcon::Panel, iconWidth ); +#endif +} + + +#include "tdewalletmanager.moc" diff --git a/tdewallet/tdewalletmanager.desktop b/tdewallet/tdewalletmanager.desktop new file mode 100644 index 0000000..915a341 --- /dev/null +++ b/tdewallet/tdewalletmanager.desktop @@ -0,0 +1,63 @@ +[Desktop Entry] +Name=Wallet Management Tool +Name[ar]=أداة إدارة المحفظة +Name[bg]=Портфейл +Name[br]=Merour an doug-paperoù +Name[bs]=Alat za upravljanje novčanikom +Name[ca]=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]=Verwaltung für digitale Brieftasche +Name[el]=Εργαλείο διαχείρισης πορτοφολιού +Name[es]=Herramienta de gestión de cartera +Name[et]=Turvalaeka haldur +Name[eu]=Kartera Kudeatzeko Tresna +Name[fa]=ابزار مدیریت Wallet +Name[fi]=Lompakon hallintatyökalu +Name[fr]=Outil de gestion de comptes +Name[ga]=Uirlis Bhainisteoireachta Wallet +Name[he]=כלי לניהול הארנק של TDE +Name[hi]= बटुआ प्रबंधन औज़ार +Name[hu]=Kezelőprogram a TDE digitális noteszeihez +Name[is]=Tól til að stýra eiginleikum veskisins +Name[it]=Strumento per la gestione dei portafogli +Name[ja]=ウォレット管理ツール +Name[ka]=Wallet-ის მმართველი მოწყობილობა +Name[kk]=Әмиянін басқару құралы +Name[km]=ឧបករណ៍គ្រប់គ្រងកាបូប +Name[lt]=Spatažodinių tvarkymo įrankis +Name[mk]=Алатка за менаџирање на паричници +Name[nb]=Wallet administrasjonsverktøy +Name[nds]=Knipp-Pleger +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 da Carteira +Name[ro]=Administrare portofel +Name[ru]=Управление паролями +Name[sk]=Nástroj na správu KWallet +Name[sl]=Orodje za upravljanje z listnicami +Name[sr]=Алат за управљање новчаником +Name[sr@Latn]=Alat za upravljanje novčanikom +Name[sv]=Hanteringsverktyg för plånbok +Name[ta]=வாலட் மேலாண்மை கருவி +Name[tg]=Асбоби Идоракунии Ҳамён +Name[tr]=Cüzdan Yönetim Aracı +Name[uk]=Засіб керування торбинками +Name[uz]=Qopchiq boshqarish vositasi +Name[uz@cyrillic]=Қопчиқ бошқариш воситаси +Name[zh_CN]=钱包管理工具 +Name[zh_TW]=錢包管理工具 +Exec=tdewalletmanager %u +MimeType=application/x-kde-wallet; +InitialPreference=6 +Icon=tdewalletmanager +Type=Application +Terminal=false +X-TDE-StartupNotify=false +Categories=Qt;TDE;Settings; +DocPath=tdewallet/index.html diff --git a/tdewallet/tdewalletmanager.h b/tdewallet/tdewalletmanager.h new file mode 100644 index 0000000..23103d5 --- /dev/null +++ b/tdewallet/tdewalletmanager.h @@ -0,0 +1,85 @@ +/* + Copyright (C) 2003,2004 George Staikos <[email protected]> + + 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 KWALLETMANAGER_H +#define KWALLETMANAGER_H + +#include <kmainwindow.h> +#include <dcopobject.h> +#include <tqptrlist.h> + +class KSystemTray; +class KWalletIconView; +class TQIconViewItem; +class DCOPRef; + + +class KWalletManager : public KMainWindow, public DCOPObject { + Q_OBJECT +// + K_DCOP + + public: + KWalletManager(TQWidget *parent = 0, const char* name = 0, WFlags f = 0); + virtual ~KWalletManager(); + + TQPixmap loadSystemTrayIcon(const TQString &icon); + + void tdewalletdLaunch(); + + public slots: + void createWallet(); + void deleteWallet(const TQString& walletName); + void closeWallet(const TQString& walletName); + void changeWalletPassword(const TQString& walletName); + void openWallet(const TQString& walletName); + void openWallet(const TQString& walletName, bool newWallet); + void openWalletFile(const TQString& path); + void openWallet(TQIconViewItem *item); + void contextMenu(TQIconViewItem *item, const TQPoint& pos); + + protected: + virtual bool queryClose(); + + private: + k_dcop: + ASYNC allWalletsClosed(); + ASYNC updateWalletDisplay(); + ASYNC aWalletWasOpened(); + + private slots: + void shuttingDown(); + void possiblyQuit(); + void editorClosed(KMainWindow* e); + void possiblyRescan(const TQCString& app); + void setupWallet(); + void openWallet(); + void deleteWallet(); + void closeAllWallets(); + + private: + KSystemTray *_tray; + bool _shuttingDown; + KWalletIconView *_iconView; + DCOPRef *_dcopRef; + TQPtrList<KMainWindow> _windows; + bool _tdewalletdLaunch; +}; + +#endif diff --git a/tdewallet/tdewalletmanager.rc b/tdewallet/tdewalletmanager.rc new file mode 100644 index 0000000..509e4b0 --- /dev/null +++ b/tdewallet/tdewalletmanager.rc @@ -0,0 +1,14 @@ +<!DOCTYPE kpartgui> +<kpartgui name="tdewalletmanager" version="3"> + <MenuBar> + <Menu name="file"><text>&File</text> + <Action name="wallet_create"/> + <Action name="close_all_wallets"/> + </Menu> + <Menu name="settings"><text>&Settings</text> + <Action name="wallet_settings" append="configure_merge"/> + </Menu> + <Menu name="help"><text>&Help</text> + </Menu> + </MenuBar> +</kpartgui> diff --git a/tdewallet/tdewalletpopup.cpp b/tdewallet/tdewalletpopup.cpp new file mode 100644 index 0000000..05f142d --- /dev/null +++ b/tdewallet/tdewalletpopup.cpp @@ -0,0 +1,110 @@ +/* + Copyright (C) 2003 George Staikos <[email protected]> + + 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 "tdewalletpopup.h" + +#include <kaction.h> +#include <kdebug.h> +#include <kiconview.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <tdewallet.h> +#include <kstdguiitem.h> + +KWalletPopup::KWalletPopup(const TQString& wallet, TQWidget *parent, const char *name) +: KPopupMenu(parent, name), _walletName(wallet) { + insertTitle(wallet); + KActionCollection *ac = new KActionCollection(this, "tdewallet context actions"); + KAction *act; + + act = new KAction(i18n("&New Wallet..."), 0, 0, TQT_TQOBJECT(this), + TQT_SLOT(createWallet()), ac, "wallet_create"); + act->plug(this); + + act = new KAction(i18n("&Open..."), 0, Key_Return, TQT_TQOBJECT(this), + TQT_SLOT(openWallet()), ac, "wallet_open"); + act->plug(this); + + act = new KAction(i18n("Change &Password..."), 0, 0, TQT_TQOBJECT(this), + TQT_SLOT(changeWalletPassword()), ac, "wallet_password"); + act->plug(this); + + TQStringList ul = KWallet::Wallet::users(wallet); + if (!ul.isEmpty()) { + KPopupMenu *pm = new KPopupMenu(this, "Disconnect Apps"); + int id = 7000; + for (TQStringList::Iterator it = ul.begin(); it != ul.end(); ++it) { + _appMap[id] = *it; + pm->insertItem(*it, this, TQT_SLOT(disconnectApp(int)), 0, id); + pm->setItemParameter(id, id); + id++; + } + + insertItem(i18n("Disconnec&t"), pm); + } + + act = KStdAction::close( TQT_TQOBJECT(this), + TQT_SLOT(closeWallet()), ac, "wallet_close"); + // FIXME: let's track this inside the manager so we don't need a dcop + // roundtrip here. + act->setEnabled(KWallet::Wallet::isOpen(wallet)); + act->plug(this); + + act = new KAction(i18n("&Delete"), 0, Key_Delete, TQT_TQOBJECT(this), + TQT_SLOT(deleteWallet()), ac, "wallet_delete"); + act->plug(this); +} + + +KWalletPopup::~KWalletPopup() { +} + + +void KWalletPopup::openWallet() { + emit walletOpened(_walletName); +} + + +void KWalletPopup::deleteWallet() { + emit walletDeleted(_walletName); +} + + +void KWalletPopup::closeWallet() { + emit walletClosed(_walletName); +} + + +void KWalletPopup::changeWalletPassword() { + emit walletChangePassword(_walletName); +} + + +void KWalletPopup::createWallet() { + emit walletCreated(); +} + + +void KWalletPopup::disconnectApp(int id) { + KWallet::Wallet::disconnectApplication(_walletName, _appMap[id].latin1()); +} + +#include "tdewalletpopup.moc" + diff --git a/tdewallet/tdewalletpopup.h b/tdewallet/tdewalletpopup.h new file mode 100644 index 0000000..8ef78b0 --- /dev/null +++ b/tdewallet/tdewalletpopup.h @@ -0,0 +1,55 @@ +/* + Copyright (C) 2003 George Staikos <[email protected]> + + 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 KWALLETPOPUP_H +#define KWALLETPOPUP_H + +#include <kpopupmenu.h> +#include <tqmap.h> +#include <tqstring.h> + +class KWalletPopup : public KPopupMenu { + Q_OBJECT + + + public: + KWalletPopup(const TQString& wallet, TQWidget *parent = 0, const char* name = 0); + virtual ~KWalletPopup(); + + public slots: + void openWallet(); + void deleteWallet(); + void closeWallet(); + void createWallet(); + void changeWalletPassword(); + void disconnectApp(int); + + signals: + void walletOpened(const TQString& walletName); + void walletClosed(const TQString& walletName); + void walletDeleted(const TQString& walletName); + void walletCreated(); + void walletChangePassword(const TQString& walletName); + + private: + TQString _walletName; + TQMap<int,TQString> _appMap; +}; + +#endif diff --git a/tdewallet/walletwidget.ui b/tdewallet/walletwidget.ui new file mode 100644 index 0000000..9979097 --- /dev/null +++ b/tdewallet/walletwidget.ui @@ -0,0 +1,416 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>WalletWidget</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>WalletWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>614</width> + <height>507</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQSplitter" row="0" column="0"> + <property name="name"> + <cstring>_splitter</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="TQFrame"> + <property name="name"> + <cstring>_entryListFrame</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + </widget> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KSqueezedTextLabel" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>_entryName</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>227</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="TQPushButton" row="3" column="1"> + <property name="name"> + <cstring>_undoChanges</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Undo</string> + </property> + <property name="iconSet"> + <iconset>"undo"</iconset> + </property> + </widget> + <widget class="TQLayoutWidget" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>_iconTitle</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="TQLabel"> + <property name="name"> + <cstring>_entryTitle</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string></string> + </property> + <property name="textFormat"> + <enum>RichText</enum> + </property> + <property name="alignment"> + <set>AlignVCenter</set> + </property> + </widget> + </hbox> + </widget> + <widget class="TQPushButton" row="3" column="2"> + <property name="name"> + <cstring>_saveChanges</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Save</string> + </property> + <property name="iconSet"> + <iconset>"filesave"</iconset> + </property> + </widget> + <widget class="TQWidgetStack" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>_entryStack</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQTextEdit" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>_passwordValue</cstring> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>271</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton" row="0" column="0"> + <property name="name"> + <cstring>_hideContents</cstring> + </property> + <property name="text"> + <string>Hide &Contents</string> + </property> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>3</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="TQLabel" row="1" column="1"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>This is a binary data entry. It cannot be editted as its format is unknown and application specific.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>41</height> + </size> + </property> + </spacer> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>41</height> + </size> + </property> + </spacer> + <spacer row="1" column="2"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>41</height> + </size> + </property> + </spacer> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>41</width> + <height>21</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>4</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>236</width> + <height>21</height> + </size> + </property> + </spacer> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer6_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>358</height> + </size> + </property> + </spacer> + <widget class="TQPushButton" row="0" column="0"> + <property name="name"> + <cstring>_showContents</cstring> + </property> + <property name="text"> + <string>Show &Contents</string> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> + <include location="global" impldecl="in implementation">kiconloader.h</include> +</includes> +<pixmapfunction>SmallIconSet</pixmapfunction> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> |