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

kwallet

  • sources
  • kde-4.14
  • kdeutils
  • kwalletmanager
  • src
  • manager
allyourbase.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003-2005 George Staikos <staikos@kde.org>
3  Copyright (C) 2005 Isaac Clerencia <isaac@warp.es>
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "allyourbase.h"
22 
23 #include <kdebug.h>
24 #include <kcomponentdata.h>
25 #include <kglobal.h>
26 #include <kio/netaccess.h>
27 #include <klocale.h>
28 #include <kmessagebox.h>
29 #include <kstandarddirs.h>
30 #include <kurl.h>
31 #include <kwallet.h>
32 
33 #include <QFile>
34 #include <QApplication>
35 //Added by qt3to4:
36 #include <QPixmap>
37 #include <QDropEvent>
38 #include <QDragEnterEvent>
39 #include <QMouseEvent>
40 
41 /****************
42  * KWalletFolderItem - ListView items to represent kwallet folders
43  */
44 KWalletFolderItem::KWalletFolderItem(KWallet::Wallet *w, QTreeWidget* parent, const QString &name, int entries)
45 : QTreeWidgetItem(parent, KWalletFolderItemClass),_wallet(w),_name(name),_entries(entries) {
46  setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(_entries));
47  setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
48  setIcon(0, getFolderIcon(KIconLoader::Small));
49 }
50 
51 QPixmap KWalletFolderItem::getFolderIcon(KIconLoader::Group group){
52  KIconLoader *loader = KIconLoader::global();
53  QPixmap pix = loader->loadIcon( _name, group, 0,
54  KIconLoader::DefaultState, QStringList(),0, true );
55  if (pix.isNull())
56  pix = loader->loadIcon( _name.toLower(), group, 0,
57  KIconLoader::DefaultState, QStringList(),0, true);
58  if (pix.isNull())
59  pix = loader->loadIcon( QLatin1String( "folder-red" ), group, 0,
60  KIconLoader::DefaultState, QStringList(),0, true);
61  return pix;
62 }
63 
64 void KWalletFolderItem::refresh() {
65  const QString saveFolder = _wallet->currentFolder();
66  _wallet->setFolder(_name);
67  setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(_wallet->entryList().count()));
68  _wallet->setFolder(saveFolder);
69 }
70 
71 void KWalletFolderItem::refreshItemsCount()
72 {
73  int visibleLeafCount =0;
74  for (int i=0; i < childCount(); i++) {
75  QTreeWidgetItem* wi = child(i);
76  if (wi->childCount()) {
77  for (int l=0; l < wi->childCount(); l++) {
78  QTreeWidgetItem* li = wi->child(l);
79  if (!li->isHidden())
80  visibleLeafCount++;
81  }
82  }
83  }
84  setText(0, QString::fromLatin1("%1 (%2)").arg(_name).arg(visibleLeafCount));
85 }
86 
87 KWalletContainerItem* KWalletFolderItem::getContainer(KWallet::Wallet::EntryType type) {
88  for (int i = 0; i < childCount(); ++i) {
89  KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(child(i));
90  if (!ci) {
91  continue;
92  }
93  if (ci->entryType() == type) {
94  return ci;
95  }
96  }
97  return 0;
98 }
99 
100 bool KWalletFolderItem::contains(const QString& key) {
101  return (getItem(key) != 0);
102 }
103 
104 QTreeWidgetItem* KWalletFolderItem::getItem(const QString& key) {
105  for (int i = 0; i < childCount(); ++i) {
106  KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(child(i));
107  if (!ci) {
108  continue;
109  }
110  QTreeWidgetItem *tmp = ci->getItem(key);
111  if (tmp) {
112  return tmp;
113  }
114  }
115  return 0;
116 }
117 
118 bool KWalletFolderItem::acceptDrop(const QMimeSource *mime) const {
119  return mime->provides("application/x-kwallet-entry") ||
120  mime->provides("text/uri-list");
121 }
122 
123 QString KWalletFolderItem::name() const {
124  return _name;
125 }
126 
127 KWalletFolderItem::~KWalletFolderItem() {
128 }
129 
130 /****************
131  * KWalletContainerItem - ListView items to represent kwallet containers, i.e.
132  * passwords, maps, ...
133  */
134 KWalletContainerItem::KWalletContainerItem(QTreeWidgetItem* parent, const QString &name, KWallet::Wallet::EntryType entryType)
135 : QTreeWidgetItem(parent, QStringList() << name, KWalletContainerItemClass), _type(entryType) {
136  setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
137 }
138 
139 KWalletContainerItem::~KWalletContainerItem() {
140 }
141 
142 KWallet::Wallet::EntryType KWalletContainerItem::entryType() {
143  return _type;
144 }
145 
146 bool KWalletContainerItem::contains(const QString& key) {
147  return getItem(key) != 0;
148 }
149 
150 QTreeWidgetItem *KWalletContainerItem::getItem(const QString& key) {
151  for (int i = 0; i < childCount(); ++i) {
152  KWalletEntryItem* entryItem = dynamic_cast<KWalletEntryItem *>(child(i));
153  if (entryItem && entryItem->name() == key) {
154  return entryItem;
155  }
156  }
157  return 0;
158 }
159 
160 /****************
161  * KWalletEntryItem - ListView items to represent kwallet entries
162  */
163 KWalletEntryItem::KWalletEntryItem(KWallet::Wallet *w, QTreeWidgetItem* parent, const QString& ename)
164 : QTreeWidgetItem(parent, QStringList() << ename, KWalletEntryItemClass), _wallet(w), m_name(ename) {
165  setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
166 }
167 
168 KWalletEntryItem::~KWalletEntryItem() {
169 }
170 
171 void KWalletEntryItem::setName(const QString& n)
172 {
173  m_name = n;
174  QTreeWidgetItem::setText(0, n);
175 }
176 
177 void KWalletEntryItem::restoreName()
178 {
179  QTreeWidgetItem::setText(0, m_name);
180 }
181 
182 
183 /****************
184  * KWalletItem - IconView items to represent wallets
185  */
186 KWalletItem::KWalletItem(QListWidget *parent, const QString& walletName)
187 : QListWidgetItem(DesktopIcon(QLatin1String( "wallet-closed" )), walletName, parent), _open(false) {
188  setFlags(flags() | Qt::ItemIsDropEnabled);
189 }
190 
191 KWalletItem::~KWalletItem() {
192 }
193 
194 void KWalletItem::setOpen(bool state) {
195  if (_open != state) {
196  _open = state;
197  if (_open) {
198  setIcon( DesktopIcon(QLatin1String( "wallet-open" )) );
199  } else {
200  setIcon( DesktopIcon(QLatin1String( "wallet-closed" )) );
201  }
202  }
203 }
204 
205 static bool decodeEntry(KWallet::Wallet *_wallet, QDataStream& ds) {
206  quint32 magic;
207  ds >> magic;
208  if (magic != KWALLETENTRYMAGIC) {
209  kDebug() << "bad magic" ;
210  return false;
211  }
212  QString name;
213  QByteArray value;
214  KWallet::Wallet::EntryType et;
215  ds >> name;
216  if (_wallet->hasEntry(name)) {
217  int rc = KMessageBox::warningContinueCancel(0L, i18n("An entry by the name '%1' already exists. Would you like to continue?", name));
218  if (rc == KMessageBox::Cancel) {
219  return false;
220  }
221  }
222  qint32 l;
223  ds >> l;
224  et = KWallet::Wallet::EntryType(l);
225  ds >> value;
226  _wallet->writeEntry(name, value, et);
227  return true;
228 }
229 
230 static bool decodeFolder(KWallet::Wallet *_wallet, QDataStream& ds) {
231  quint32 magic;
232  ds >> magic;
233  if (magic != KWALLETFOLDERMAGIC) {
234  kDebug() << "bad magic" ;
235  return false;
236  }
237  QString folder;
238  ds >> folder;
239  if (_wallet->hasFolder(folder)) {
240  int rc = KMessageBox::warningYesNoCancel(0L, i18n("A folder by the name '%1' already exists. What would you like to do?", folder), QString(), KStandardGuiItem::cont(), KGuiItem(i18n("Replace")));
241  if (rc == KMessageBox::Cancel) {
242  return false;
243  }
244  if (rc == KMessageBox::No) {
245  _wallet->removeFolder(folder);
246  _wallet->createFolder(folder);
247  }
248  } else {
249  _wallet->createFolder(folder);
250  }
251 
252  _wallet->setFolder(folder);
253  while (!ds.atEnd()) {
254  QString name;
255  QByteArray value;
256  KWallet::Wallet::EntryType et;
257  ds >> name;
258  qint32 l;
259  ds >> l;
260  et = KWallet::Wallet::EntryType(l);
261  ds >> value;
262  _wallet->writeEntry(name, value, et);
263  }
264  return true;
265 }
266 
267 void KWalletItem::processDropEvent(QDropEvent *e) {
268  if (e->provides("application/x-kwallet-folder") ||
269  e->provides("text/uri-list")) {
270  // FIXME: don't allow the drop if the wallet name is the same
271  KWallet::Wallet *_wallet = KWallet::Wallet::openWallet(text(), listWidget()->topLevelWidget()->winId());
272  if (!_wallet) {
273  e->ignore();
274  return;
275  }
276 
277  const QString saveFolder = _wallet->currentFolder();
278 
279  QDataStream *ds = 0L;
280 
281  if (e->provides("application/x-kwallet-folder")) {
282  QByteArray edata = e->encodedData("application/x-kwallet-folder");
283  if (!edata.isEmpty()) {
284  ds = new QDataStream(&edata, QIODevice::ReadOnly);
285  }
286  } else { // text/uri-list
287  const QList<QUrl> urls = e->mimeData()->urls();
288  if (urls.isEmpty()) {
289  e->ignore();
290  return;
291  }
292 
293  KUrl u(urls.first());
294  if (u.fileName().isEmpty()) {
295  e->ignore();
296  return;
297  }
298  QString tmpFile;
299  if (KIO::NetAccess::download(u, tmpFile, 0L)) {
300  QFile file;
301  file.setFileName(tmpFile);
302  file.open(QIODevice::ReadOnly);
303  ds = new QDataStream(&file);
304  KIO::NetAccess::removeTempFile(tmpFile);
305  } else {
306  KMessageBox::error(listWidget(), KIO::NetAccess::lastErrorString());
307  }
308  }
309  if (ds) {
310  decodeFolder(_wallet, *ds);
311  delete ds;
312  }
313  _wallet->setFolder(saveFolder);
314  delete _wallet;
315 
316  //delete the folder from the source if we were moving
317  Qt::MouseButtons state = QApplication::mouseButtons();
318  if (e->source() && e->source()->parent() &&
319  !strcmp(e->source()->parent()->metaObject()->className(), "KWalletEntryList") &&
320  !(state & Qt::ControlModifier)) {
321 
322  KWalletEntryList *el =
323  dynamic_cast<KWalletEntryList*>(e->source()->parent());
324  if (el) {
325  KWalletFolderItem *fi =
326  dynamic_cast<KWalletFolderItem*>(el->currentItem());
327  if (fi) {
328  el->_wallet->removeFolder(fi->name());
329  }
330  }
331  }
332  e->accept();
333  } else {
334  e->ignore();
335  return;
336  }
337 }
338 
339 /****************
340  * KWalletEntryList - A listview to store wallet entries
341  */
342 KWalletEntryList::KWalletEntryList(QWidget *parent, const char *name)
343 : QTreeWidget(parent),
344  _wallet(0) {
345  setObjectName( QLatin1String( name ) );
346  setColumnCount(1);
347  setHeaderLabel(i18n("Folders"));
348  setRootIsDecorated(true);
349  setDragEnabled(true);
350  setAcceptDrops(true);
351  setDragDropMode(DragDrop);
352  setSelectionMode(SingleSelection);
353 }
354 
355 KWalletEntryList::~KWalletEntryList() {
356 }
357 
358 //returns true if the item has been dropped successfully
359 void KWalletEntryList::itemDropped(QDropEvent *e, QTreeWidgetItem *item) {
360  bool ok = true;
361  bool isEntry;
362  QFile file;
363  QDataStream *ds;
364 
365  KWalletEntryList *el = 0L;
366  QTreeWidgetItem *sel = 0L;
367 
368  //detect if we are dragging from kwallet itself
369  kDebug() << e->source() << e->source()->metaObject()->className();
370  if (e->source() && !strcmp(e->source()->metaObject()->className(), "KWalletEntryList")) {
371 
372  el = dynamic_cast<KWalletEntryList*>(e->source());
373  if (!el) {
374  KMessageBox::error(this, i18n("An unexpected error occurred trying to drop the item"));
375  } else
376  sel = el->currentItem();
377  }
378 
379  if (e->provides("application/x-kwallet-entry")) {
380  //do nothing if we are in the same folder
381  if (sel && sel->parent()->parent() ==
382  KWalletEntryList::getItemFolder(item)) {
383  e->ignore();
384  return;
385  }
386  isEntry = true;
387  QByteArray data = e->encodedData("application/x-kwallet-entry");
388  if (data.isEmpty()) {
389  e->ignore();
390  return;
391  }
392  ds = new QDataStream(&data, QIODevice::ReadOnly);
393  } else if (e->provides("application/x-kwallet-folder")) {
394  //do nothing if we are in the same wallet
395  if (this == el) {
396  e->ignore();
397  return;
398  }
399  isEntry = false;
400  QByteArray data = e->encodedData("application/x-kwallet-folder");
401  if (data.isEmpty()) {
402  e->ignore();
403  return;
404  }
405  ds = new QDataStream(&data, QIODevice::ReadOnly);
406  } else if (e->provides("text/uri-list")) {
407  const QList<QUrl> urls = e->mimeData()->urls();
408  if (urls.isEmpty()) {
409  e->ignore();
410  return;
411  }
412  KUrl u(urls.first());
413  if (u.fileName().isEmpty()) {
414  e->ignore();
415  return;
416  }
417  QString tmpFile;
418  if (KIO::NetAccess::download(u, tmpFile, 0L)) {
419  file.setFileName(tmpFile);
420  file.open(QIODevice::ReadOnly);
421  ds = new QDataStream(&file);
422  //check magic to discover mime type
423  quint32 magic;
424  (*ds) >> magic;
425  delete ds;
426  if (magic == KWALLETENTRYMAGIC) {
427  isEntry = true;
428  } else if (magic == KWALLETFOLDERMAGIC) {
429  isEntry = false;
430  } else {
431  kDebug() << "bad magic" ;
432  e->ignore();
433  return;
434  }
435  //set the file back to the beginning
436  file.reset();
437  ds = new QDataStream(&file);
438  KIO::NetAccess::removeTempFile(tmpFile);
439  } else {
440  KMessageBox::error(this, KIO::NetAccess::lastErrorString());
441  return;
442  }
443  } else {
444  e->ignore();
445  return;
446  }
447  Qt::MouseButtons state = QApplication::mouseButtons();
448  if (isEntry) {
449  if (!item) {
450  e->ignore();
451  delete(ds);
452  return;
453  }
454  KWalletFolderItem *fi = KWalletEntryList::getItemFolder(item);
455  if (!fi) {
456  KMessageBox::error(this, i18n("An unexpected error occurred trying to drop the entry"));
457  delete(ds);
458  e->accept();
459  return;
460  }
461  QString saveFolder = _wallet->currentFolder();
462  _wallet->setFolder(fi->name());
463  ok = decodeEntry(_wallet, *ds);
464  _wallet->setFolder(saveFolder);
465  fi->refresh();
466  delete(ds);
467  //delete source if we were moving, i.e., we are dragging
468  //from kwalletmanager and Control is not pressed
469  if (ok && el && !(state & Qt::ControlModifier) && sel) {
470  el->_wallet->removeEntry(sel->text(0));
471  delete sel;
472  }
473  e->accept();
474  } else {
475  ok = decodeFolder(_wallet, *ds);
476  delete ds;
477  //delete source if we were moving, i.e., we are dragging
478  //from kwalletmanager and Control is not pressed
479  if (ok && el && !(state & Qt::ControlModifier) && sel) {
480  KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(sel);
481  if (fi) {
482  el->_wallet->removeFolder(fi->name());
483  delete sel;
484  } else {
485  KMessageBox::error(this, i18n("An unexpected error occurred trying to delete the original folder, but the folder has been copied successfully"));
486  }
487  }
488  e->accept();
489  }
490 }
491 
492 void KWalletEntryList::setWallet(KWallet::Wallet *w) {
493  _wallet = w;
494 }
495 
496 bool KWalletEntryList::existsFolder(const QString& name) {
497  for (int i = 0; i < topLevelItemCount(); ++i) {
498  KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
499  if (!fi) {
500  continue;
501  }
502  if (name == fi->name()) {
503  return true;
504  }
505  }
506  return false;
507 }
508 
509 QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const {
510  QMimeData *sd = 0L;
511  if (i->type() == KWalletEntryItemClass) {
512  const KWalletEntryItem *ei = dynamic_cast<const KWalletEntryItem*>(i);
513  if (!ei) {
514  return 0L;
515  }
516  KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem*>(ei->parent());
517  if (!ci) {
518  return 0L;
519  }
520  sd = new QMimeData();
521  QByteArray a;
522  QDataStream ds(&a, QIODevice::WriteOnly);
523 
524  ds.setVersion(QDataStream::Qt_3_1);
525  ds << KWALLETENTRYMAGIC;
526  ds << ei->text(0);
527  ds << ci->entryType();
528  QByteArray value;
529  ei->_wallet->readEntry(i->text(0), value);
530  ds << value;
531  sd->setData("application/x-kwallet-entry", a);
532  } else if (i->type() == KWalletFolderItemClass) {
533  const KWalletFolderItem *fi = dynamic_cast<const KWalletFolderItem*>(i);
534  if (!fi) {
535  return 0L;
536  }
537  sd = new QMimeData();
538  QByteArray a;
539  QDataStream ds(&a, QIODevice::WriteOnly);
540 
541  ds.setVersion(QDataStream::Qt_3_1);
542 
543  ds << KWALLETFOLDERMAGIC;
544  ds << *fi;
545  sd->setData("application/x-kwallet-folder", a);
546  }
547  return sd;
548 }
549 
550 void KWalletEntryList::mousePressEvent(QMouseEvent *e) {
551  if (e->button() == Qt::LeftButton)
552  _mousePos = e->pos();
553  QTreeWidget::mousePressEvent( e );
554 }
555 
556 void KWalletEntryList::mouseMoveEvent(QMouseEvent *e) {
557  if (!(e->buttons() & Qt::LeftButton))
558  return;
559  if ((e->pos() - _mousePos).manhattanLength() < QApplication::startDragDistance())
560  return;
561 
562  const QTreeWidgetItem *item = itemAt(_mousePos);
563  if (!item || !item->isSelected())
564  return;
565 
566  QMimeData *mimeData = itemMimeData(item);
567  if (mimeData) {
568  QDrag *drag = new QDrag(this);
569  drag->setMimeData(mimeData);
570  drag->setHotSpot(QPoint(0,0));
571  drag->exec();
572  }
573 }
574 
575 void KWalletEntryList::dropEvent(QDropEvent *e) {
576  QTreeWidgetItem *i = itemAt(e->pos());
577  itemDropped(e, i);
578 }
579 
580 void KWalletEntryList::dragEnterEvent(QDragEnterEvent *e) {
581  e->accept();
582 }
583 
584 void KWalletEntryList::dragMoveEvent(QDragMoveEvent *e) {
585  QTreeWidgetItem *i = itemAt(e->pos());
586  e->ignore();
587  if (i) {
588  if (e->provides("application/x-kwallet-entry") ||
589  e->provides("text/uri-list")) {
590  e->accept();
591  }
592  }
593  if ((e->provides("application/x-kwallet-folder") &&
594  e->source() != viewport()) ||
595  e->provides("text/uri-list")) {
596  e->accept();
597  }
598 }
599 
600 KWalletFolderItem* KWalletEntryList::getFolder(const QString& name) {
601  for (int i = 0; i < topLevelItemCount(); ++i) {
602  KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(topLevelItem(i));
603  if (!fi) {
604  continue;
605  }
606  if (name == fi->name()) {
607  return fi;
608  }
609  }
610  return 0;
611 }
612 
613 KWalletFolderItem *KWalletEntryList::getItemFolder(QTreeWidgetItem *item) {
614  switch (item->type()) {
615  case KWalletFolderItemClass:
616  return dynamic_cast<KWalletFolderItem *>(item);
617  case KWalletContainerItemClass:
618  return dynamic_cast<KWalletFolderItem *>(item->parent());
619  case KWalletEntryItemClass:
620  return dynamic_cast<KWalletFolderItem *>(item->parent()->parent());
621  }
622  return 0;
623 }
624 
625 void KWalletEntryList::selectFirstVisible()
626 {
627  QTreeWidgetItemIterator it(this);
628  while (*it) {
629  QTreeWidgetItem *item = *it++;
630  if (!item->isHidden()) {
631  // if it's a leaf, then select it and quit
632  if (item->childCount() ==0) {
633 // kDebug() << "selecting " << item->text(0);
634  setCurrentItem(item);
635  break;
636  }
637  }
638  }
639 }
640 
641 void KWalletEntryList::refreshItemsCount()
642 {
643  QTreeWidgetItemIterator it(this);
644  while (*it) {
645  QTreeWidgetItem *item = *it++;
646  KWalletFolderItem *fi = dynamic_cast< KWalletFolderItem* >(item);
647  if (fi) {
648  fi->refreshItemsCount();
649  }
650  }
651 }
652 
653 class ReturnPressedFilter : public QObject
654 {
655  public:
656  ReturnPressedFilter(KListWidget *parent) : QObject(parent)
657  {
658  parent->installEventFilter(this);
659  }
660 
661  bool eventFilter(QObject * /*watched*/, QEvent *event)
662  {
663  if (event->type () == QEvent::KeyPress)
664  {
665  QKeyEvent *ke = static_cast<QKeyEvent *>(event);
666  if (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return)
667  {
668  KListWidget *p = static_cast<KListWidget*>(parent());
669  QMetaObject::invokeMethod(p, "executed", Q_ARG(QListWidgetItem*, p->currentItem()));
670  return true;
671  }
672  }
673  return false;
674  }
675 };
676 
677 #include "allyourbase.moc"
QApplication::mouseButtons
Qt::MouseButtons mouseButtons()
KWalletFolderItem::refreshItemsCount
void refreshItemsCount()
Definition: allyourbase.cpp:71
QDropEvent::source
QWidget * source() const
QDrag::setHotSpot
void setHotSpot(const QPoint &hotspot)
QEvent
QWidget
QEvent::type
Type type() const
QTreeWidgetItem::isSelected
bool isSelected() const
KWalletEntryList::~KWalletEntryList
virtual ~KWalletEntryList()
Definition: allyourbase.cpp:355
KWalletItem::KWalletItem
KWalletItem(QListWidget *parent, const QString &walletName)
Definition: allyourbase.cpp:186
QDropEvent::mimeData
const QMimeData * mimeData() const
QAbstractItemView::setSelectionMode
void setSelectionMode(QAbstractItemView::SelectionMode mode)
KWalletFolderItem::acceptDrop
virtual bool acceptDrop(const QMimeSource *mime) const
Definition: allyourbase.cpp:118
KWalletEntryList::_mousePos
QPoint _mousePos
Definition: allyourbase.h:126
QDrag::setMimeData
void setMimeData(QMimeData *data)
QByteArray
QTreeWidgetItem::child
QTreeWidgetItem * child(int index) const
QDragMoveEvent
QListWidgetItem::listWidget
QListWidget * listWidget() const
KWALLETENTRYMAGIC
#define KWALLETENTRYMAGIC
Definition: allyourbase.h:34
QDataStream
KWalletContainerItem
Definition: allyourbase.h:63
KWalletEntryItem::~KWalletEntryItem
virtual ~KWalletEntryItem()
Definition: allyourbase.cpp:168
KWalletEntryList::getFolder
KWalletFolderItem * getFolder(const QString &name)
Definition: allyourbase.cpp:600
QTreeWidgetItemIterator
QDropEvent::pos
const QPoint & pos() const
KWalletEntryList::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *e)
Definition: allyourbase.cpp:580
QTreeWidgetItem::setIcon
void setIcon(int column, const QIcon &icon)
QByteArray::isEmpty
bool isEmpty() const
QAbstractItemView::setDragDropMode
void setDragDropMode(DragDropMode behavior)
QListWidgetItem
QFile::setFileName
void setFileName(const QString &name)
KWalletFolderItem::getFolderIcon
QPixmap getFolderIcon(KIconLoader::Group group)
Definition: allyourbase.cpp:51
QObject::metaObject
virtual const QMetaObject * metaObject() const
KWalletFolderItem
Definition: allyourbase.h:77
QAbstractScrollArea::viewport
QWidget * viewport() const
KWalletFolderItem::getContainer
KWalletContainerItem * getContainer(KWallet::Wallet::EntryType type)
Definition: allyourbase.cpp:87
KWalletEntryList
Definition: allyourbase.h:100
QPoint
QMouseEvent
QMouseEvent::buttons
Qt::MouseButtons buttons() const
KWalletContainerItem::getItem
QTreeWidgetItem * getItem(const QString &itemKey)
Definition: allyourbase.cpp:150
KWalletFolderItemClass
Definition: allyourbase.h:39
QListWidget
QListWidgetItem::flags
Qt::ItemFlags flags() const
QDropEvent::provides
virtual bool provides(const char *mimeType) const
QMimeData
QFile
KWalletFolderItem::name
QString name() const
Definition: allyourbase.cpp:123
KWalletEntryItemClass
Definition: allyourbase.h:41
QObject::event
virtual bool event(QEvent *e)
QDrag::exec
Qt::DropAction exec(QFlags< Qt::DropAction > supportedActions)
KWalletEntryList::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *e)
Definition: allyourbase.cpp:556
QTreeWidgetItem::setFlags
void setFlags(QFlags< Qt::ItemFlag > flags)
QTreeWidget
KWalletEntryList::itemDropped
void itemDropped(QDropEvent *e, QTreeWidgetItem *item)
Definition: allyourbase.cpp:359
QEvent::ignore
void ignore()
KWalletFolderItem::~KWalletFolderItem
virtual ~KWalletFolderItem()
Definition: allyourbase.cpp:127
KWalletEntryItem::KWalletEntryItem
KWalletEntryItem(KWallet::Wallet *w, QTreeWidgetItem *parent, const QString &ename)
Definition: allyourbase.cpp:163
QObject::installEventFilter
void installEventFilter(QObject *filterObj)
decodeEntry
static bool decodeEntry(KWallet::Wallet *_wallet, QDataStream &ds)
Definition: allyourbase.cpp:205
QDragMoveEvent::accept
void accept()
KWalletEntryItem::restoreName
void restoreName()
Definition: allyourbase.cpp:177
QObject
QMouseEvent::button
Qt::MouseButton button() const
KWalletEntryList::dropEvent
virtual void dropEvent(QDropEvent *e)
Definition: allyourbase.cpp:575
QDropEvent
QList::isEmpty
bool isEmpty() const
QTreeWidget::mimeData
virtual QMimeData * mimeData(const QList< QTreeWidgetItem * > items) const
QListWidgetItem::setFlags
void setFlags(QFlags< Qt::ItemFlag > flags)
QObject::setObjectName
void setObjectName(const QString &name)
QDrag
KWalletEntryList::setWallet
void setWallet(KWallet::Wallet *w)
Definition: allyourbase.cpp:492
QTreeWidget::itemAt
QTreeWidgetItem * itemAt(const QPoint &p) const
QTreeWidgetItem::isHidden
bool isHidden() const
KWalletContainerItemClass
Definition: allyourbase.h:40
QObject::eventFilter
virtual bool eventFilter(QObject *watched, QEvent *event)
QList::first
T & first()
QTreeWidget::currentItem
QTreeWidgetItem * currentItem() const
QString
QList
KWalletFolderItem::refresh
void refresh()
Definition: allyourbase.cpp:64
KWalletEntryItem::name
const QString & name() const
Definition: allyourbase.h:50
QIODevice::reset
virtual bool reset()
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QDataStream::atEnd
bool atEnd() const
QTreeWidget::setColumnCount
void setColumnCount(int columns)
decodeFolder
static bool decodeFolder(KWallet::Wallet *_wallet, QDataStream &ds)
Definition: allyourbase.cpp:230
QStringList
KWalletFolderItem::getItem
QTreeWidgetItem * getItem(const QString &itemKey)
Definition: allyourbase.cpp:104
KWalletEntryList::KWalletEntryList
KWalletEntryList(QWidget *parent, const char *name=0L)
Definition: allyourbase.cpp:342
QPixmap
QWidget::setAcceptDrops
void setAcceptDrops(bool on)
QDragMoveEvent::ignore
void ignore()
QString::toLower
QString toLower() const
QKeyEvent::key
int key() const
QPixmap::isNull
bool isNull() const
QDropEvent::encodedData
virtual QByteArray encodedData(const char *format) const
QListWidgetItem::setIcon
void setIcon(const QIcon &icon)
QMetaObject::className
const char * className() const
KWalletContainerItem::KWalletContainerItem
KWalletContainerItem(QTreeWidgetItem *parent, const QString &name, KWallet::Wallet::EntryType entryType)
Definition: allyourbase.cpp:134
QTreeWidgetItem::parent
QTreeWidgetItem * parent() const
QMetaObject::invokeMethod
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
KWalletEntryItem
Definition: allyourbase.h:45
QTreeWidget::setCurrentItem
void setCurrentItem(QTreeWidgetItem *item)
QAbstractItemView::state
State state() const
QTreeWidget::setHeaderLabel
void setHeaderLabel(const QString &label)
QKeyEvent
KWalletFolderItem::_wallet
KWallet::Wallet * _wallet
Definition: allyourbase.h:93
KWalletEntryList::dragMoveEvent
virtual void dragMoveEvent(QDragMoveEvent *e)
Definition: allyourbase.cpp:584
KWalletEntryList::_wallet
KWallet::Wallet * _wallet
Definition: allyourbase.h:125
Qt::MouseButtons
typedef MouseButtons
QDragEnterEvent
KWalletContainerItem::entryType
KWallet::Wallet::EntryType entryType()
Definition: allyourbase.cpp:142
KWalletItem::setOpen
void setOpen(bool state)
Definition: allyourbase.cpp:194
QTreeWidgetItem
QLatin1String
QMimeData::urls
QList< QUrl > urls() const
KWalletEntryList::mousePressEvent
virtual void mousePressEvent(QMouseEvent *e)
Definition: allyourbase.cpp:550
KWalletFolderItem::contains
bool contains(const QString &itemKey)
Definition: allyourbase.cpp:100
KWalletItem::~KWalletItem
virtual ~KWalletItem()
Definition: allyourbase.cpp:191
KWalletContainerItem::contains
bool contains(const QString &itemKey)
Definition: allyourbase.cpp:146
allyourbase.h
QTreeWidgetItem::setText
void setText(int column, const QString &text)
KWalletEntryList::existsFolder
bool existsFolder(const QString &name)
Definition: allyourbase.cpp:496
KWalletEntryItem::setName
void setName(const QString &n)
Definition: allyourbase.cpp:171
QString::fromLatin1
QString fromLatin1(const char *str, int size)
QTreeView::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event)
QTreeWidgetItem::type
int type() const
QMimeData::setData
void setData(const QString &mimeType, const QByteArray &data)
QTreeWidget::topLevelItem
QTreeWidgetItem * topLevelItem(int index) const
QMouseEvent::pos
const QPoint & pos() const
KWalletContainerItem::~KWalletContainerItem
virtual ~KWalletContainerItem()
Definition: allyourbase.cpp:139
QTreeView::setRootIsDecorated
void setRootIsDecorated(bool show)
QTreeWidget::topLevelItemCount
int topLevelItemCount() const
QObject::parent
QObject * parent() const
QMimeSource::provides
virtual bool provides(const char *mimeType) const
QTreeWidgetItem::childCount
int childCount() const
KWalletFolderItem::KWalletFolderItem
KWalletFolderItem(KWallet::Wallet *w, QTreeWidget *parent, const QString &name, int entries)
Definition: allyourbase.cpp:44
KWalletEntryList::selectFirstVisible
void selectFirstVisible()
Definition: allyourbase.cpp:625
QTreeWidgetItem::text
QString text(int column) const
QDropEvent::accept
void accept(bool accept)
KWalletEntryItem::_wallet
KWallet::Wallet * _wallet
Definition: allyourbase.h:56
QListWidgetItem::text
QString text() const
No
Definition: kwalleteditor.cpp:945
KWalletEntryList::refreshItemsCount
void refreshItemsCount()
Definition: allyourbase.cpp:641
QMimeSource
QApplication::startDragDistance
int startDragDistance()
KWALLETFOLDERMAGIC
#define KWALLETFOLDERMAGIC
Definition: allyourbase.h:35
QAbstractItemView::setDragEnabled
void setDragEnabled(bool enable)
KWalletItem::processDropEvent
void processDropEvent(QDropEvent *e)
Definition: allyourbase.cpp:267
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kwallet

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

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

Search



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

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