return 0;
}
-bool KWalletFolderItem::acceptDrop(const QMimeSource *mime) const {
- return mime->provides("application/x-kwallet-entry") ||
- mime->provides("text/uri-list");
+bool KWalletFolderItem::acceptDrop(const QMimeData *mimedata) const {
+ return mimedata->hasFormat(QLatin1String("application/x-kwallet-entry")) ||
+ mimedata->hasFormat(QLatin1String("text/uri-list"));
}
QString KWalletFolderItem::name() const {
}
void KWalletItem::processDropEvent(QDropEvent *e) {
- if (e->provides("application/x-kwallet-folder") ||
- e->provides("text/uri-list")) {
+ const QMimeData *em = e->mimeData();
+ if (em->hasFormat(QLatin1String("application/x-kwallet-folder")) ||
+ em->hasFormat(QLatin1String("text/uri-list"))) {
// FIXME: don't allow the drop if the wallet name is the same
KWallet::Wallet *_wallet = KWallet::Wallet::openWallet(text(), listWidget()->topLevelWidget()->winId());
if (!_wallet) {
QDataStream *ds = 0L;
- if (e->provides("application/x-kwallet-folder")) {
- QByteArray edata = e->encodedData("application/x-kwallet-folder");
+ if (em->hasFormat(QLatin1String("application/x-kwallet-folder"))) {
+ QByteArray edata = em->data(QLatin1String("application/x-kwallet-folder"));
if (!edata.isEmpty()) {
ds = new QDataStream(&edata, QIODevice::ReadOnly);
}
sel = el->currentItem();
}
- if (e->provides("application/x-kwallet-entry")) {
+ const QMimeData *em = e->mimeData();
+ if (em->hasFormat(QLatin1String("application/x-kwallet-entry"))) {
//do nothing if we are in the same folder
if (sel && sel->parent()->parent() ==
KWalletEntryList::getItemFolder(item)) {
return;
}
isEntry = true;
- QByteArray data = e->encodedData("application/x-kwallet-entry");
+ QByteArray data = em->data(QLatin1String("application/x-kwallet-entry"));
if (data.isEmpty()) {
e->ignore();
return;
}
ds = new QDataStream(&data, QIODevice::ReadOnly);
- } else if (e->provides("application/x-kwallet-folder")) {
+ } else if (em->hasFormat(QLatin1String("application/x-kwallet-folder"))) {
//do nothing if we are in the same wallet
if (this == el) {
e->ignore();
return;
}
isEntry = false;
- QByteArray data = e->encodedData("application/x-kwallet-folder");
+ QByteArray data = em->data(QLatin1String("application/x-kwallet-folder"));
if (data.isEmpty()) {
e->ignore();
return;
}
ds = new QDataStream(&data, QIODevice::ReadOnly);
- } else if (e->provides("text/uri-list")) {
+ } else if (em->hasFormat(QLatin1String("text/uri-list"))) {
const QList<QUrl> urls = e->mimeData()->urls();
if (urls.isEmpty()) {
e->ignore();
void KWalletEntryList::dragMoveEvent(QDragMoveEvent *e) {
QTreeWidgetItem *i = itemAt(e->pos());
e->ignore();
+ const QMimeData *em = e->mimeData();
if (i) {
- if (e->provides("application/x-kwallet-entry") ||
- e->provides("text/uri-list")) {
+ if (em->hasFormat(QLatin1String("application/x-kwallet-entry")) ||
+ em->hasFormat(QLatin1String("text/uri-list"))) {
e->accept();
}
}
- if ((e->provides("application/x-kwallet-folder") &&
+ if ((em->hasFormat(QLatin1String("application/x-kwallet-folder")) &&
e->source() != viewport()) ||
- e->provides("text/uri-list")) {
+ em->hasFormat(QLatin1String("text/uri-list"))) {
e->accept();
}
}
void KWalletManagerWidget::dragEnterEvent(QDragEnterEvent* e)
{
- if (e->provides("application/x-kwallet-wallet")) {
+ if (e->mimeData()->hasFormat(QLatin1String("application/x-kwallet-wallet"))) {
e->accept();
} else {
e->ignore();
// return true;
// }
//
-// if (!e->provides("application/x-kwallet-folder") &&
-// !e->provides("application/x-kwallet-wallet") &&
-// !e->provides("text/uri-list")) {
+// QMimeData *em = e->mimeData();
+// if (!em->hasFormat(QLatin1String("application/x-kwallet-folder")) &&
+// !em->hasFormat(QLatin1String("application/x-kwallet-wallet")) &&
+// !em->hasFormat(QLatin1String("text/uri-list"))) {
// return true;
// }
//
// // Over wallets folders, over nothing wallets
// *item = itemAt(e->pos());
-// const QByteArray edata = e->encodedData(item ? "application/x-kwallet-folder" : "application/x-kwallet-wallet");
+// const QByteArray edata;
+// if (item) {
+// edata = em->data(QLatin1String("application/x-kwallet-folder"));
+// } else {
+// edata = em->data(QLatin1String("application/x-kwallet-wallet"));
+// }
// *u = decodeUrl(edata);
// if (*u == KUrl()) {
// *u = decodeUrl(e->encodedData("text/uri-list"));