diff options
Diffstat (limited to 'kwallet/allyourbase.cpp')
-rw-r--r-- | kwallet/allyourbase.cpp | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/kwallet/allyourbase.cpp b/kwallet/allyourbase.cpp index add178b..917857c 100644 --- a/kwallet/allyourbase.cpp +++ b/kwallet/allyourbase.cpp @@ -31,28 +31,28 @@ #include <kurldrag.h> #include <kwallet.h> -#include <qdragobject.h> -#include <qfile.h> -#include <qptrlist.h> +#include <tqdragobject.h> +#include <tqfile.h> +#include <tqptrlist.h> /**************** * KWalletFolderItem - ListView items to represent kwallet folders */ -KWalletFolderItem::KWalletFolderItem(KWallet::Wallet *w, QListView* parent, const QString &name, int entries) +KWalletFolderItem::KWalletFolderItem(KWallet::Wallet *w, TQListView* parent, const TQString &name, int entries) : KListViewItem(parent),_wallet(w),_name(name),_entries(entries) { - setText(0, QString("%1 (%2)").arg(_name).arg(_entries)); + setText(0, TQString("%1 (%2)").arg(_name).arg(_entries)); setRenameEnabled(0, false); setDragEnabled(true); setDropEnabled(true); - QPixmap pix = getFolderIcon(KIcon::Small); + TQPixmap pix = getFolderIcon(KIcon::Small); setPixmap(0,pix); } -QPixmap KWalletFolderItem::getFolderIcon(KIcon::Group group){ +TQPixmap KWalletFolderItem::getFolderIcon(KIcon::Group group){ KIconLoader *loader = KGlobal::instance()->iconLoader(); - QPixmap pix = loader->loadIcon( _name, group, 0, + TQPixmap pix = loader->loadIcon( _name, group, 0, KIcon::DefaultState, 0, true ); if (pix.isNull()) pix = loader->loadIcon( _name.lower(), group, 0, @@ -64,14 +64,14 @@ QPixmap KWalletFolderItem::getFolderIcon(KIcon::Group group){ } void KWalletFolderItem::refresh() { - QString saveFolder = _wallet->currentFolder(); + TQString saveFolder = _wallet->currentFolder(); _wallet->setFolder(_name); - setText(0, QString("%1 (%2)").arg(_name).arg(_wallet->entryList().count())); + setText(0, TQString("%1 (%2)").arg(_name).arg(_wallet->entryList().count())); _wallet->setFolder(saveFolder); } KWalletContainerItem* KWalletFolderItem::getContainer(KWallet::Wallet::EntryType type) { - for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) { + for (TQListViewItem *i = firstChild(); i; i = i->nextSibling()) { KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(i); if (!ci) { continue; @@ -83,17 +83,17 @@ KWalletContainerItem* KWalletFolderItem::getContainer(KWallet::Wallet::EntryType return 0; } -bool KWalletFolderItem::contains(const QString& key) { +bool KWalletFolderItem::contains(const TQString& key) { return (getItem(key) != 0); } -QListViewItem* KWalletFolderItem::getItem(const QString& key) { - for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) { +TQListViewItem* KWalletFolderItem::getItem(const TQString& key) { + for (TQListViewItem *i = firstChild(); i; i = i->nextSibling()) { KWalletContainerItem *ci = dynamic_cast<KWalletContainerItem *>(i); if (!ci) { continue; } - QListViewItem *tmp = ci->getItem(key); + TQListViewItem *tmp = ci->getItem(key); if (tmp) { return tmp; } @@ -101,7 +101,7 @@ QListViewItem* KWalletFolderItem::getItem(const QString& key) { return 0; } -bool KWalletFolderItem::acceptDrop(const QMimeSource *mime) const { +bool KWalletFolderItem::acceptDrop(const TQMimeSource *mime) const { return mime->provides("application/x-kwallet-entry") || mime->provides("text/uri-list"); } @@ -110,7 +110,7 @@ int KWalletFolderItem::rtti() const { return KWalletFolderItemClass; } -QString KWalletFolderItem::name() const { +TQString KWalletFolderItem::name() const { return _name; } @@ -121,7 +121,7 @@ KWalletFolderItem::~KWalletFolderItem() { * KWalletContainerItem - ListView items to represent kwallet containers, i.e. * passwords, maps, ... */ -KWalletContainerItem::KWalletContainerItem(QListViewItem* parent, const QString &name, KWallet::Wallet::EntryType type) +KWalletContainerItem::KWalletContainerItem(TQListViewItem* parent, const TQString &name, KWallet::Wallet::EntryType type) : KListViewItem(parent, name), _type(type) { setRenameEnabled(0, false); setDragEnabled(true); @@ -138,12 +138,12 @@ KWallet::Wallet::EntryType KWalletContainerItem::type() { return _type; } -bool KWalletContainerItem::contains(const QString& key) { +bool KWalletContainerItem::contains(const TQString& key) { return getItem(key) != 0; } -QListViewItem *KWalletContainerItem::getItem(const QString& key) { - for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) { +TQListViewItem *KWalletContainerItem::getItem(const TQString& key) { + for (TQListViewItem *i = firstChild(); i; i = i->nextSibling()) { if (i->text(0) == key) { return i; } @@ -154,7 +154,7 @@ QListViewItem *KWalletContainerItem::getItem(const QString& key) { /**************** * KWalletEntryItem - ListView items to represent kwallet entries */ -KWalletEntryItem::KWalletEntryItem(KWallet::Wallet *w, QListViewItem* parent, const QString& ename) +KWalletEntryItem::KWalletEntryItem(KWallet::Wallet *w, TQListViewItem* parent, const TQString& ename) : KListViewItem(parent, ename), _wallet(w), _oldName(ename) { setRenameEnabled(0, true); setDragEnabled(true); @@ -170,27 +170,27 @@ KWalletEntryItem::~KWalletEntryItem() { /**************** * KWalletItem - IconView items to represent wallets */ -KWalletItem::KWalletItem(QIconView *parent, const QString& walletName) -: QIconViewItem(parent, walletName, DesktopIcon("kwalletmanager")) { +KWalletItem::KWalletItem(TQIconView *parent, const TQString& walletName) +: TQIconViewItem(parent, walletName, DesktopIcon("kwalletmanager")) { } KWalletItem::~KWalletItem() { } -bool KWalletItem::acceptDrop(const QMimeSource *mime) const { +bool KWalletItem::acceptDrop(const TQMimeSource *mime) const { return mime->provides("application/x-kwallet-folder") || mime->provides("text/uri-list"); } -static bool decodeEntry(KWallet::Wallet *_wallet, QDataStream& ds) { +static bool decodeEntry(KWallet::Wallet *_wallet, TQDataStream& ds) { Q_UINT32 magic; ds >> magic; if (magic != KWALLETENTRYMAGIC) { kdDebug() << "bad magic" << endl; return false; } - QString name; - QByteArray value; + TQString name; + TQByteArray value; KWallet::Wallet::EntryType et; ds >> name; if (_wallet->hasEntry(name)) { @@ -207,17 +207,17 @@ static bool decodeEntry(KWallet::Wallet *_wallet, QDataStream& ds) { return true; } -static bool decodeFolder(KWallet::Wallet *_wallet, QDataStream& ds) { +static bool decodeFolder(KWallet::Wallet *_wallet, TQDataStream& ds) { Q_UINT32 magic; ds >> magic; if (magic != KWALLETFOLDERMAGIC) { kdDebug() << "bad magic" << endl; return false; } - QString folder; + 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), QString::null, KStdGuiItem::cont(), i18n("Replace")); + int rc = KMessageBox::warningYesNoCancel(0L, i18n("A folder by the name '%1' already exists. What would you like to do?").arg(folder), TQString::null, KStdGuiItem::cont(), i18n("Replace")); if (rc == KMessageBox::Cancel) { return false; } @@ -231,8 +231,8 @@ static bool decodeFolder(KWallet::Wallet *_wallet, QDataStream& ds) { _wallet->setFolder(folder); while (!ds.atEnd()) { - QString name; - QByteArray value; + TQString name; + TQByteArray value; KWallet::Wallet::EntryType et; ds >> name; long l; @@ -244,7 +244,7 @@ static bool decodeFolder(KWallet::Wallet *_wallet, QDataStream& ds) { return true; } -void KWalletItem::dropped(QDropEvent *e, const QValueList<QIconDragItem>& lst) { +void KWalletItem::dropped(TQDropEvent *e, const TQValueList<TQIconDragItem>& lst) { Q_UNUSED(lst); if (e->provides("application/x-kwallet-folder") || e->provides("text/uri-list")) { @@ -257,19 +257,19 @@ void KWalletItem::dropped(QDropEvent *e, const QValueList<QIconDragItem>& lst) { return; } - QString saveFolder = _wallet->currentFolder(); + TQString saveFolder = _wallet->currentFolder(); - QFile file; - QDataStream *ds = 0L; + TQFile file; + TQDataStream *ds = 0L; if (e->provides("application/x-kwallet-folder")) { - QByteArray edata = e->encodedData("application/x-kwallet-folder"); + TQByteArray edata = e->encodedData("application/x-kwallet-folder"); if (!edata.isEmpty()) { - ds = new QDataStream(edata, IO_ReadOnly); + ds = new TQDataStream(edata, IO_ReadOnly); } } else { // text/uri-list - QStrList urls; - QUriDrag::decode(e, urls); + TQStrList urls; + TQUriDrag::decode(e, urls); if (urls.isEmpty()) { e->ignore(); @@ -281,11 +281,11 @@ void KWalletItem::dropped(QDropEvent *e, const QValueList<QIconDragItem>& lst) { e->ignore(); return; } - QString tmpFile; + TQString tmpFile; if (KIO::NetAccess::download(u, tmpFile, 0L)) { file.setName(tmpFile); file.open(IO_ReadOnly); - ds = new QDataStream(&file); + ds = new TQDataStream(&file); KIO::NetAccess::removeTempFile(tmpFile); } else { KMessageBox::error(iconView(), KIO::NetAccess::lastErrorString()); @@ -324,10 +324,10 @@ void KWalletItem::dropped(QDropEvent *e, const QValueList<QIconDragItem>& lst) { /**************** * KWalletEntryDrag - Stores data for wallet entry drags */ -class KWalletEntryDrag : public QStoredDrag { +class KWalletEntryDrag : public TQStoredDrag { public: - KWalletEntryDrag(QWidget *dragSource, const char *name = 0L) - : QStoredDrag("application/x-kwallet-entry", dragSource, name) { + KWalletEntryDrag(TQWidget *dragSource, const char *name = 0L) + : TQStoredDrag("application/x-kwallet-entry", dragSource, name) { } virtual ~KWalletEntryDrag() {} @@ -336,10 +336,10 @@ class KWalletEntryDrag : public QStoredDrag { /**************** * KWalletFolderDrag - Stores data for wallet folder drags */ -class KWalletFolderDrag : public QStoredDrag { +class KWalletFolderDrag : public TQStoredDrag { public: - KWalletFolderDrag(QWidget *dragSource, const char *name = 0L) - : QStoredDrag("application/x-kwallet-folder", dragSource, name) { + KWalletFolderDrag(TQWidget *dragSource, const char *name = 0L) + : TQStoredDrag("application/x-kwallet-folder", dragSource, name) { } virtual ~KWalletFolderDrag() {} @@ -348,7 +348,7 @@ class KWalletFolderDrag : public QStoredDrag { /**************** * KWalletEntryList - A listview to store wallet entries */ -KWalletEntryList::KWalletEntryList(QWidget *parent, const char *name) +KWalletEntryList::KWalletEntryList(TQWidget *parent, const char *name) : KListView(parent, name) { addColumn(i18n("Folders")); setRootIsDecorated(true); @@ -362,8 +362,8 @@ KWalletEntryList::KWalletEntryList(QWidget *parent, const char *name) KWalletEntryList::~KWalletEntryList() { } -bool KWalletEntryList::acceptDrag(QDropEvent* e) const { - QListViewItem *i = itemAt(contentsToViewport(e->pos())); +bool KWalletEntryList::acceptDrag(TQDropEvent* e) const { + TQListViewItem *i = itemAt(contentsToViewport(e->pos())); if (i) { if (e->provides("application/x-kwallet-entry") || e->provides("text/uri-list")) { @@ -379,14 +379,14 @@ bool KWalletEntryList::acceptDrag(QDropEvent* e) const { } //returns true if the item has been dropped successfully -void KWalletEntryList::itemDropped(QDropEvent *e, QListViewItem *item) { +void KWalletEntryList::itemDropped(TQDropEvent *e, TQListViewItem *item) { bool ok = true; bool isEntry; - QFile file; - QDataStream *ds; + TQFile file; + TQDataStream *ds; KWalletEntryList *el = 0L; - QListViewItem *sel = 0L; + TQListViewItem *sel = 0L; //detect if we are dragging from kwallet itself if (e->source() && e->source()->parent() && @@ -407,12 +407,12 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QListViewItem *item) { return; } isEntry = true; - QByteArray data = e->encodedData("application/x-kwallet-entry"); + TQByteArray data = e->encodedData("application/x-kwallet-entry"); if (data.isEmpty()) { e->ignore(); return; } - ds = new QDataStream(data, IO_ReadOnly); + ds = new TQDataStream(data, IO_ReadOnly); } else if (e->provides("application/x-kwallet-folder")) { //do nothing if we are in the same wallet if (this == el) { @@ -420,15 +420,15 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QListViewItem *item) { return; } isEntry = false; - QByteArray data = e->encodedData("application/x-kwallet-folder"); + TQByteArray data = e->encodedData("application/x-kwallet-folder"); if (data.isEmpty()) { e->ignore(); return; } - ds = new QDataStream(data, IO_ReadOnly); + ds = new TQDataStream(data, IO_ReadOnly); } else if (e->provides("text/uri-list")) { - QStrList urls; - QUriDrag::decode(e, urls); + TQStrList urls; + TQUriDrag::decode(e, urls); if (urls.isEmpty()) { e->ignore(); return; @@ -438,11 +438,11 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QListViewItem *item) { e->ignore(); return; } - QString tmpFile; + TQString tmpFile; if (KIO::NetAccess::download(u, tmpFile, 0L)) { file.setName(tmpFile); file.open(IO_ReadOnly); - ds = new QDataStream(&file); + ds = new TQDataStream(&file); //check magic to discover mime type Q_UINT32 magic; (*ds) >> magic; @@ -458,7 +458,7 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QListViewItem *item) { delete ds; //set the file back to the beginning file.reset(); - ds = new QDataStream(&file); + ds = new TQDataStream(&file); KIO::NetAccess::removeTempFile(tmpFile); } else { KMessageBox::error(this, KIO::NetAccess::lastErrorString()); @@ -481,7 +481,7 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QListViewItem *item) { e->accept(); return; } - QString saveFolder = _wallet->currentFolder(); + TQString saveFolder = _wallet->currentFolder(); _wallet->setFolder(fi->name()); ok = decodeEntry(_wallet, *ds); _wallet->setFolder(saveFolder); @@ -516,8 +516,8 @@ void KWalletEntryList::setWallet(KWallet::Wallet *w) { _wallet = w; } -bool KWalletEntryList::existsFolder(const QString& name) { - for (QListViewItem *vi = firstChild(); vi; vi = vi->nextSibling()) { +bool KWalletEntryList::existsFolder(const TQString& name) { + for (TQListViewItem *vi = firstChild(); vi; vi = vi->nextSibling()) { KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(vi); if (!fi) { continue; @@ -529,12 +529,12 @@ bool KWalletEntryList::existsFolder(const QString& name) { return false; } -void KWalletEntryList::contentsDropEvent(QDropEvent *e) { - QListViewItem *i = itemAt(contentsToViewport(e->pos())); +void KWalletEntryList::contentsDropEvent(TQDropEvent *e) { + TQListViewItem *i = itemAt(contentsToViewport(e->pos())); itemDropped(e, i); } -void KWalletEntryList::contentsDragEnterEvent(QDragEnterEvent *e) { +void KWalletEntryList::contentsDragEnterEvent(TQDragEnterEvent *e) { if (e->provides("application/x-kwallet-entry") || e->provides("application/x-kwallet-folder") || e->provides("application/uri-list")) { @@ -544,8 +544,8 @@ void KWalletEntryList::contentsDragEnterEvent(QDragEnterEvent *e) { } } -KWalletFolderItem* KWalletEntryList::getFolder(const QString& name) { - for (QListViewItem *vi = firstChild(); vi; vi = vi->nextSibling()) { +KWalletFolderItem* KWalletEntryList::getFolder(const TQString& name) { + for (TQListViewItem *vi = firstChild(); vi; vi = vi->nextSibling()) { KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(vi); if (!fi) { continue; @@ -557,7 +557,7 @@ KWalletFolderItem* KWalletEntryList::getFolder(const QString& name) { return 0; } -KWalletFolderItem *KWalletEntryList::getItemFolder(QListViewItem *item) { +KWalletFolderItem *KWalletEntryList::getItemFolder(TQListViewItem *item) { switch (item->rtti()) { case KWalletFolderItemClass: return dynamic_cast<KWalletFolderItem *>(item); @@ -572,10 +572,10 @@ KWalletFolderItem *KWalletEntryList::getItemFolder(QListViewItem *item) { /**************** * KWalletIconDrag - Stores the data for wallet drags */ -class KWalletIconDrag : public QIconDrag { +class KWalletIconDrag : public TQIconDrag { public: - KWalletIconDrag(QWidget *dragSource, const char *name = 0L) - : QIconDrag(dragSource, name) { + KWalletIconDrag(TQWidget *dragSource, const char *name = 0L) + : TQIconDrag(dragSource, name) { } virtual ~KWalletIconDrag() {} @@ -589,13 +589,13 @@ class KWalletIconDrag : public QIconDrag { return 0L; } - QByteArray encodedData(const char *mime) const { - QByteArray a; - QCString mimetype(mime); + TQByteArray encodedData(const char *mime) const { + TQByteArray a; + TQCString mimetype(mime); if (mimetype == "application/x-qiconlist") { - return QIconDrag::encodedData(mime); + return TQIconDrag::encodedData(mime); } else if (mimetype == "text/uri-list") { - QCString s = _urls.join("\r\n").latin1(); + TQCString s = _urls.join("\r\n").latin1(); if (_urls.count() > 0) { s.append("\r\n"); } @@ -605,29 +605,29 @@ class KWalletIconDrag : public QIconDrag { return a; } - void append(const QIconDragItem &item, const QRect &pr, - const QRect &tr, const QString &url) { - QIconDrag::append(item, pr, tr); + void append(const TQIconDragItem &item, const TQRect &pr, + const TQRect &tr, const TQString &url) { + TQIconDrag::append(item, pr, tr); _urls.append(url); } private: - QStringList _urls; + TQStringList _urls; }; /**************** * * KWalletIconView - An iconview to store wallets * */ -KWalletIconView::KWalletIconView(QWidget *parent, const char *name) +KWalletIconView::KWalletIconView(TQWidget *parent, const char *name) : KIconView(parent, name) { KGlobal::dirs()->addResourceType("kwallet", "share/apps/kwallet"); - connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)), SLOT(slotDropped(QDropEvent*, const QValueList<QIconDragItem>&))); + connect(this, TQT_SIGNAL(dropped(TQDropEvent*, const TQValueList<TQIconDragItem>&)), TQT_SLOT(slotDropped(TQDropEvent*, const TQValueList<TQIconDragItem>&))); } KWalletIconView::~KWalletIconView() { } -void KWalletIconView::slotDropped(QDropEvent *e, const QValueList<QIconDragItem>& /*lst*/) { +void KWalletIconView::slotDropped(TQDropEvent *e, const TQValueList<TQIconDragItem>& /*lst*/) { if (e->source() == viewport()) { e->ignore(); return; @@ -638,10 +638,10 @@ void KWalletIconView::slotDropped(QDropEvent *e, const QValueList<QIconDragItem> return; } - QByteArray edata = e->encodedData("text/uri-list"); - QCString urls = edata.data(); + TQByteArray edata = e->encodedData("text/uri-list"); + TQCString urls = edata.data(); - QStringList ul = QStringList::split("\r\n", urls); + TQStringList ul = TQStringList::split("\r\n", urls); if (ul.isEmpty() || ul.first().isEmpty()) { e->ignore(); return; @@ -654,8 +654,8 @@ void KWalletIconView::slotDropped(QDropEvent *e, const QValueList<QIconDragItem> return; } - QString dest = KGlobal::dirs()->saveLocation("kwallet") + u.fileName(); - if (QFile::exists(dest)) { + TQString dest = KGlobal::dirs()->saveLocation("kwallet") + u.fileName(); + if (TQFile::exists(dest)) { KMessageBox::sorry(viewport(), i18n("That wallet file already exists. You cannot overwrite wallets.")); e->ignore(); return; @@ -666,7 +666,7 @@ void KWalletIconView::slotDropped(QDropEvent *e, const QValueList<QIconDragItem> e->accept(); } -void KWalletIconView::contentsMousePressEvent(QMouseEvent *e) { +void KWalletIconView::contentsMousePressEvent(TQMouseEvent *e) { _mousePos = e->pos(); if (!findItem(_mousePos)) { clearSelection(); @@ -674,19 +674,19 @@ void KWalletIconView::contentsMousePressEvent(QMouseEvent *e) { KIconView::contentsMousePressEvent( e ); } -QDragObject *KWalletIconView::dragObject() { +TQDragObject *KWalletIconView::dragObject() { KWalletIconDrag* id = new KWalletIconDrag(viewport(), "KWallet Drag"); - QString path = "file:" + KGlobal::dirs()->saveLocation("kwallet"); - QPoint pos = _mousePos; - for (QIconViewItem *item = firstItem(); item; item = item->nextItem()) { + TQString path = "file:" + KGlobal::dirs()->saveLocation("kwallet"); + TQPoint pos = _mousePos; + for (TQIconViewItem *item = firstItem(); item; item = item->nextItem()) { if (item->isSelected()) { - QString url = path + item->text() + ".kwl"; - QIconDragItem idi; + TQString url = path + item->text() + ".kwl"; + TQIconDragItem idi; idi.setData(url.local8Bit()); id->append(idi, - QRect(item->pixmapRect(false).topLeft() - pos, + TQRect(item->pixmapRect(false).topLeft() - pos, item->pixmapRect(false).size()), - QRect(item->textRect(false).topLeft() - pos, + TQRect(item->textRect(false).topLeft() - pos, item->textRect(false).size()), url); } @@ -698,10 +698,10 @@ QDragObject *KWalletIconView::dragObject() { return id; } -QDragObject *KWalletEntryList::dragObject() { - QListViewItem *i = currentItem(); +TQDragObject *KWalletEntryList::dragObject() { + TQListViewItem *i = currentItem(); - QStoredDrag *sd = 0L; + TQStoredDrag *sd = 0L; if (i->rtti() == KWalletEntryItemClass) { KWalletEntryItem *ei = dynamic_cast<KWalletEntryItem*>(i); @@ -709,8 +709,8 @@ QDragObject *KWalletEntryList::dragObject() { return 0L; } sd = new KWalletEntryDrag(viewport(), "KWallet Entry Drag"); - QByteArray a; - QDataStream ds(a, IO_WriteOnly); + TQByteArray a; + TQDataStream ds(a, IO_WriteOnly); ds << KWALLETENTRYMAGIC; ds << *ei; sd->setEncodedData(a); @@ -720,8 +720,8 @@ QDragObject *KWalletEntryList::dragObject() { return 0L; } sd = new KWalletFolderDrag(viewport(), "KWallet Folder Drag"); - QByteArray a; - QDataStream ds(a, IO_WriteOnly); + TQByteArray a; + TQDataStream ds(a, IO_WriteOnly); ds << KWALLETFOLDERMAGIC; ds << *fi; |