Hello community,

here is the log from the commit of package kwalletmanager5 for openSUSE:Factory 
checked in at 2016-08-29 14:47:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kwalletmanager5 (Old)
 and      /work/SRC/openSUSE:Factory/.kwalletmanager5.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kwalletmanager5"

Changes:
--------
--- /work/SRC/openSUSE:Factory/kwalletmanager5/kwalletmanager5.changes  
2016-07-21 07:48:25.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.kwalletmanager5.new/kwalletmanager5.changes     
2016-08-29 14:47:44.000000000 +0200
@@ -1,0 +2,16 @@
+Fri Aug 12 10:27:55 UTC 2016 - [email protected]
+
+- Update to KDE Applications 16.08.0
+   * KDE Applications 16.08.0
+   * https://www.kde.org/announcements/announce-applications-16.08.0.php
+
+
+-------------------------------------------------------------------
+Mon Aug  8 15:34:06 UTC 2016 - [email protected]
+
+- Update to KDE Applications 16.07.90
+   * KDE Applications 16.07.90 (16.08-RC)
+   * https://www.kde.org/announcements/announce-applications-16.07.90.php
+
+
+-------------------------------------------------------------------

Old:
----
  kwalletmanager-16.04.3.tar.xz

New:
----
  kwalletmanager-16.08.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kwalletmanager5.spec ++++++
--- /var/tmp/diff_new_pack.ZHxH2p/_old  2016-08-29 14:47:46.000000000 +0200
+++ /var/tmp/diff_new_pack.ZHxH2p/_new  2016-08-29 14:47:46.000000000 +0200
@@ -18,7 +18,7 @@
 
 %define rname   kwalletmanager
 Name:           kwalletmanager5
-Version:        16.04.3
+Version:        16.08.0
 Release:        0
 Summary:        Wallet Management Tool
 License:        GPL-2.0+

++++++ kwalletmanager-16.04.3.tar.xz -> kwalletmanager-16.08.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/CMakeLists.txt 
new/kwalletmanager-16.08.0/CMakeLists.txt
--- old/kwalletmanager-16.04.3/CMakeLists.txt   2016-07-02 18:03:10.000000000 
+0200
+++ new/kwalletmanager-16.08.0/CMakeLists.txt   2016-08-11 15:04:34.000000000 
+0200
@@ -2,8 +2,8 @@
 
 # KDE Application Version, managed by release script
 set (KDE_APPLICATIONS_VERSION_MAJOR "16")
-set (KDE_APPLICATIONS_VERSION_MINOR "04")
-set (KDE_APPLICATIONS_VERSION_MICRO "3")
+set (KDE_APPLICATIONS_VERSION_MINOR "08")
+set (KDE_APPLICATIONS_VERSION_MICRO "0")
 set (KDE_APPLICATIONS_VERSION 
"${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
 
 cmake_minimum_required(VERSION 2.8.12)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/doc/index.docbook 
new/kwalletmanager-16.08.0/doc/index.docbook
--- old/kwalletmanager-16.04.3/doc/index.docbook        2016-07-02 
18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/doc/index.docbook        2016-08-11 
15:04:34.000000000 +0200
@@ -2,8 +2,6 @@
 <!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" 
"dtd/kdedbx45.dtd" [
   <!ENTITY kwallet5 "<application>KWallet</application>">
   <!ENTITY kwalletmanager5 "<application>KWallet Manager</application>">
-  <!ENTITY package "kwallet5">
-  <!ENTITY kappname "&kwallet5;">
   <!ENTITY % addindex "IGNORE">
   <!ENTITY % English "INCLUDE">
 ]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kwalletmanager-16.04.3/org.kde.kwalletmanager5.desktop 
new/kwalletmanager-16.08.0/org.kde.kwalletmanager5.desktop
--- old/kwalletmanager-16.04.3/org.kde.kwalletmanager5.desktop  2016-07-02 
18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/org.kde.kwalletmanager5.desktop  2016-08-11 
15:04:34.000000000 +0200
@@ -88,7 +88,7 @@
 Comment[uk]=Засіб KDE для керування торбинками
 Comment[x-test]=xxKDE Wallet Management Toolxx
 Comment[zh_CN]=KDE 钱包管理工具
-Comment[zh_TW]=錢包管理工具
+Comment[zh_TW]=KDE 錢包管理工具
 GenericName=Wallet Management Tool
 GenericName[ar]=أداة إدارة المحفظة
 GenericName[ast]=Ferramienta de xestión de carteres
@@ -155,5 +155,5 @@
 Terminal=false
 StartupNotify=false
 Categories=Qt;KDE;System;Security;
-X-DocPath=kwallet/index.html
+X-DocPath=kwallet5/index.html
 X-DBUS-ServiceName=org.kde.kwalletmanager5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kwalletmanager-16.04.3/src/konfigurator/konfigurator.cpp 
new/kwalletmanager-16.08.0/src/konfigurator/konfigurator.cpp
--- old/kwalletmanager-16.04.3/src/konfigurator/konfigurator.cpp        
2016-07-02 18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/src/konfigurator/konfigurator.cpp        
2016-08-11 15:04:34.000000000 +0200
@@ -228,8 +228,8 @@
         QString walletName = *i;
         // perform cleanup in the kwalletrc file, by removing entries that 
correspond to non-existent
         // (previously deleted, for example) wallets
-        QString path = 
QStandardPaths::writableLocation(QStandardPaths::DataLocation);
-        path.append(QString("/kwallet/%1.kwl").arg(walletName));
+        QString path = 
QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
+        path.append(QString("/kwalletd/%1.kwl").arg(walletName));
         if (!QFile::exists(path)) {
             // if the wallet no longer exists, delete the entries from the 
configuration file and skip to next entry
             KConfigGroup cfgAllow = 
KSharedConfig::openConfig("kwalletrc")->group("Auto Allow");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/src/manager/CMakeLists.txt 
new/kwalletmanager-16.08.0/src/manager/CMakeLists.txt
--- old/kwalletmanager-16.04.3/src/manager/CMakeLists.txt       2016-07-02 
18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/src/manager/CMakeLists.txt       2016-08-11 
15:04:34.000000000 +0200
@@ -3,6 +3,7 @@
     kwalletmanager.cpp
     kwalletmanagerwidget.cpp
     kwalletmanagerwidgetitem.cpp
+    kwhexview.cpp
     walletcontrolwidget.cpp
     main.cpp
     kwalletpopup.cpp
@@ -49,6 +50,8 @@
     KF5::DBusAddons
     KF5::ConfigCore
     KF5::Service
+    KF5::KIOCore
+    KF5::JobWidgets
     KF5::KDELibs4Support
     KF5::Archive
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/src/manager/allyourbase.cpp 
new/kwalletmanager-16.08.0/src/manager/allyourbase.cpp
--- old/kwalletmanager-16.04.3/src/manager/allyourbase.cpp      2016-07-02 
18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/src/manager/allyourbase.cpp      2016-08-11 
15:04:34.000000000 +0200
@@ -20,8 +20,9 @@
 
 #include "allyourbase.h"
 
-#include <kio/netaccess.h>
+#include <KJobWidgets>
 #include <klocalizedstring.h>
+#include <KIO/StoredTransferJob>
 #include <kmessagebox.h>
 #include <qurl.h>
 #include <kwallet.h>
@@ -284,6 +285,17 @@
 
 void KWalletItem::processDropEvent(QDropEvent *e)
 {
+    // We fetch this here at the beginning because we run an event loop further
+    // down which might lead to the event data getting deleted
+    KWalletEntryList *el = nullptr;
+    Qt::DropAction proposedAction = e->proposedAction();
+    if (e->source() && e->source()->parent() &&
+            !strcmp(e->source()->parent()->metaObject()->className(), 
"KWalletEntryList") &&
+            (proposedAction != Qt::CopyAction)) {
+
+        el = dynamic_cast<KWalletEntryList *>(e->source()->parent());
+    }
+
     if (e->mimeData()->hasFormat("application/x-kwallet-folder") ||
             e->mimeData()->hasFormat("text/uri-list")) {
         // FIXME: don't allow the drop if the wallet name is the same
@@ -295,13 +307,11 @@
 
         const QString saveFolder = _wallet->currentFolder();
 
-        QDataStream *ds = 0L;
+        QByteArray data;
 
         if (e->mimeData()->hasFormat("application/x-kwallet-folder")) {
-            QByteArray edata = 
e->mimeData()->data("application/x-kwallet-folder");
-            if (!edata.isEmpty()) {
-                ds = new QDataStream(&edata, QIODevice::ReadOnly);
-            }
+            data = e->mimeData()->data("application/x-kwallet-folder");
+            e->accept();
         } else { // text/uri-list
             const QList<QUrl> urls = e->mimeData()->urls();
             if (urls.isEmpty()) {
@@ -314,41 +324,33 @@
                 e->ignore();
                 return;
             }
-            QString tmpFile;
-            if (KIO::NetAccess::download(u, tmpFile, 0L)) {
-                QFile file;
-                file.setFileName(tmpFile);
-                file.open(QIODevice::ReadOnly);
-                ds = new QDataStream(&file);
-                KIO::NetAccess::removeTempFile(tmpFile);
+            KIO::StoredTransferJob *job = KIO::storedGet(u);
+            KJobWidgets::setWindow(job, listWidget());
+
+            e->accept();
+            if (job->exec()) {
+                data = job->data();
             } else {
-                KMessageBox::error(listWidget(), 
KIO::NetAccess::lastErrorString());
+                KMessageBox::error(listWidget(), job->errorString());
             }
         }
-        if (ds) {
-            decodeFolder(_wallet, *ds);
-            delete ds;
+
+        if (!data.isEmpty()) {
+            QDataStream ds(data);
+            decodeFolder(_wallet, ds);
         }
+
         _wallet->setFolder(saveFolder);
         delete _wallet;
 
         //delete the folder from the source if we were moving
-        Qt::MouseButtons state = QApplication::mouseButtons();
-        if (e->source() && e->source()->parent() &&
-                !strcmp(e->source()->parent()->metaObject()->className(), 
"KWalletEntryList") &&
-                !(state & Qt::ControlModifier)) {
-
-            KWalletEntryList *el =
-                dynamic_cast<KWalletEntryList *>(e->source()->parent());
-            if (el) {
-                KWalletFolderItem *fi =
-                    dynamic_cast<KWalletFolderItem *>(el->currentItem());
-                if (fi) {
-                    el->_wallet->removeFolder(fi->name());
-                }
+        if (el) {
+            KWalletFolderItem *fi =
+                dynamic_cast<KWalletFolderItem *>(el->currentItem());
+            if (fi) {
+                el->_wallet->removeFolder(fi->name());
             }
         }
-        e->accept();
     } else {
         e->ignore();
         return;
@@ -381,12 +383,19 @@
 {
     bool ok = true;
     bool isEntry;
-    QFile file;
-    QDataStream *ds;
+    QByteArray data;
 
     KWalletEntryList *el = 0L;
     QTreeWidgetItem *sel = 0L;
 
+    // We fetch this here because we run an event loop further down which 
might invalidate this
+    Qt::DropAction proposedAction = e->proposedAction();
+
+    if (!item) {
+        e->ignore();
+        return;
+    }
+
     //detect if we are dragging from kwallet itself
     qDebug() << e->source() << e->source()->metaObject()->className();
     if (e->source() && !strcmp(e->source()->metaObject()->className(), 
"KWalletEntryList")) {
@@ -407,12 +416,12 @@
             return;
         }
         isEntry = true;
-        QByteArray data = e->mimeData()->data("application/x-kwallet-entry");
+        data = e->mimeData()->data("application/x-kwallet-entry");
         if (data.isEmpty()) {
             e->ignore();
             return;
         }
-        ds = new QDataStream(&data, QIODevice::ReadOnly);
+        e->accept();
     } else if (e->mimeData()->hasFormat("application/x-kwallet-folder")) {
         //do nothing if we are in the same wallet
         if (this == el) {
@@ -420,12 +429,12 @@
             return;
         }
         isEntry = false;
-        QByteArray data = e->mimeData()->data("application/x-kwallet-folder");
+        data = e->mimeData()->data("application/x-kwallet-folder");
         if (data.isEmpty()) {
             e->ignore();
             return;
         }
-        ds = new QDataStream(&data, QIODevice::ReadOnly);
+        e->accept();
     } else if (e->mimeData()->hasFormat("text/uri-list")) {
         const QList<QUrl> urls = e->mimeData()->urls();
         if (urls.isEmpty()) {
@@ -437,69 +446,57 @@
             e->ignore();
             return;
         }
-        QString tmpFile;
-        if (KIO::NetAccess::download(u, tmpFile, 0L)) {
-            file.setFileName(tmpFile);
-            file.open(QIODevice::ReadOnly);
-            ds = new QDataStream(&file);
-            //check magic to discover mime type
-            quint32 magic;
-            (*ds) >> magic;
-            delete ds;
-            if (magic == KWALLETENTRYMAGIC) {
-                isEntry = true;
-            } else if (magic == KWALLETFOLDERMAGIC) {
-                isEntry = false;
-            } else {
-                qDebug() << "bad magic" ;
-                e->ignore();
-                return;
-            }
-            //set the file back to the beginning
-            file.reset();
-            ds = new QDataStream(&file);
-            KIO::NetAccess::removeTempFile(tmpFile);
+
+        e->accept();
+
+        KIO::StoredTransferJob *job = KIO::storedGet(u);
+        KJobWidgets::setWindow(job, this);
+        if (!job->exec()) {
+            KMessageBox::error(this, job->errorString());
+            return;
+        }
+        data = job->data();
+
+        QByteArray entryMagic(QByteArray::number(KWALLETENTRYMAGIC));
+        QByteArray folderMagic(QByteArray::number(KWALLETFOLDERMAGIC));
+
+        if (data.startsWith(entryMagic)) {
+            isEntry = true;
+        } else if (data.startsWith(folderMagic)) {
+            isEntry = false;
         } else {
-            KMessageBox::error(this, KIO::NetAccess::lastErrorString());
+            qDebug() << "bad magic" ;
             return;
         }
     } else {
         e->ignore();
         return;
     }
-    Qt::MouseButtons state = QApplication::mouseButtons();
+
+    QDataStream ds(data);
+
     if (isEntry) {
-        if (!item) {
-            e->ignore();
-            delete(ds);
-            return;
-        }
         KWalletFolderItem *fi = KWalletEntryList::getItemFolder(item);
         if (!fi) {
             KMessageBox::error(this, i18n("An unexpected error occurred trying 
to drop the entry"));
-            delete(ds);
-            e->accept();
             return;
         }
         QString saveFolder = _wallet->currentFolder();
         _wallet->setFolder(fi->name());
-        ok = decodeEntry(_wallet, *ds);
+        ok = decodeEntry(_wallet, ds);
         _wallet->setFolder(saveFolder);
         fi->refresh();
-        delete(ds);
         //delete source if we were moving, i.e., we are dragging
         //from kwalletmanager and Control is not pressed
-        if (ok && el && !(state & Qt::ControlModifier) && sel) {
+        if (ok && el && proposedAction != Qt::CopyAction && sel) {
             el->_wallet->removeEntry(sel->text(0));
             delete sel;
         }
-        e->accept();
     } else {
-        ok = decodeFolder(_wallet, *ds);
-        delete ds;
+        ok = decodeFolder(_wallet, ds);
         //delete source if we were moving, i.e., we are dragging
         //from kwalletmanager and Control is not pressed
-        if (ok && el && !(state & Qt::ControlModifier) && sel) {
+        if (ok && el && proposedAction != Qt::CopyAction && sel) {
             KWalletFolderItem *fi = dynamic_cast<KWalletFolderItem *>(sel);
             if (fi) {
                 el->_wallet->removeFolder(fi->name());
@@ -508,7 +505,6 @@
                 KMessageBox::error(this, i18n("An unexpected error occurred 
trying to delete the original folder, but the folder has been copied 
successfully"));
             }
         }
-        e->accept();
     }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/src/manager/kwalleteditor.cpp 
new/kwalletmanager-16.08.0/src/manager/kwalleteditor.cpp
--- old/kwalletmanager-16.04.3/src/manager/kwalleteditor.cpp    2016-07-02 
18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/src/manager/kwalleteditor.cpp    2016-08-11 
15:04:34.000000000 +0200
@@ -26,7 +26,9 @@
 #include <qaction.h>
 #include <qdialog.h>
 #include <qinputdialog.h>
-#include <kio/netaccess.h>
+#include <KIO/StoredTransferJob>
+#include <KJobUiDelegate>
+#include <KJobWidgets>
 #include <kactioncollection.h>
 #include <kcodecs.h>
 #include <kmessagebox.h>
@@ -137,6 +139,7 @@
     connect(_showContents, &QToolButton::clicked, this, 
&KWalletEditor::showPasswordContents);
     connect(_hideContents, &QToolButton::clicked, this, 
&KWalletEditor::hidePasswordContents);
 
+    _binaryViewShow->setChecked(_alwaysShowContents);
 //    createActions();
     // TODO: remove kwalleteditor.rc file
 }
@@ -558,6 +561,7 @@
                                              item->text(0)));
                     _saveChanges->setEnabled(false);
                     _undoChanges->setEnabled(false);
+                    _binaryView->setData(ba);
                 }
             }
             break;
@@ -935,13 +939,22 @@
         return;
     }
 
-    QString tmpFile;
-    if (!KIO::NetAccess::download(url, tmpFile, this)) {
+    QTemporaryFile tmpFile;
+    if (!tmpFile.open()) {
+        KMessageBox::sorry(this, i18n("Unable to create temporary file for 
downloading '<b>%1</b>'.", url.toDisplayString()));
+        return;
+    }
+
+    KIO::StoredTransferJob *job = KIO::storedGet(url);
+    KJobWidgets::setWindow(job, this);
+    if (!job->exec()) {
         KMessageBox::sorry(this, i18n("Unable to access wallet '<b>%1</b>'.", 
url.toDisplayString()));
         return;
     }
+    tmpFile.write(job->data());
+    tmpFile.flush();
 
-    KWallet::Wallet *w = KWallet::Wallet::openWallet(tmpFile, 
effectiveWinId(), KWallet::Wallet::Path);
+    KWallet::Wallet *w = KWallet::Wallet::openWallet(tmpFile.fileName(), 
effectiveWinId(), KWallet::Wallet::Path);
     if (w && w->isOpen()) {
         MergePlan mp = Prompt;
         QStringList fl = w->folderList();
@@ -1058,7 +1071,6 @@
 
     delete w;
 
-    KIO::NetAccess::removeTempFile(tmpFile);
     updateFolderList(true);
     restoreEntry();
 }
@@ -1071,30 +1083,22 @@
         return;
     }
 
-    QString tmpFile;
-    if (!KIO::NetAccess::download(url, tmpFile, this)) {
+    KIO::StoredTransferJob *job = KIO::storedGet(url);
+    KJobWidgets::setWindow(job, this);
+    if (!job->exec()) {
         KMessageBox::sorry(this, i18n("Unable to access XML file 
'<b>%1</b>'.", url.toDisplayString()));
         return;
     }
 
-    QFile qf(tmpFile);
-    if (!qf.open(QIODevice::ReadOnly)) {
-        KMessageBox::sorry(this, i18n("Error opening XML file '<b>%1</b>' for 
input.", url.toDisplayString()));
-        KIO::NetAccess::removeTempFile(tmpFile);
-        return;
-    }
-
-    QDomDocument doc(tmpFile);
-    if (!doc.setContent(&qf)) {
+    QDomDocument doc;
+    if (!doc.setContent(job->data())) {
         KMessageBox::sorry(this, i18n("Error reading XML file '<b>%1</b>' for 
input.", url.toDisplayString()));
-        KIO::NetAccess::removeTempFile(tmpFile);
         return;
     }
 
     QDomElement top = doc.documentElement();
     if (top.tagName().toLower() != QLatin1String("wallet")) {
         KMessageBox::sorry(this, i18n("Error: XML file does not contain a 
wallet."));
-        KIO::NetAccess::removeTempFile(tmpFile);
         return;
     }
 
@@ -1165,7 +1169,6 @@
         n = n.nextSibling();
     }
 
-    KIO::NetAccess::removeTempFile(tmpFile);
     updateFolderList(true);
     restoreEntry();
 }
@@ -1237,8 +1240,14 @@
 
     QUrl url = QFileDialog::getSaveFileUrl(this, QString(), QUrl(), 
QLatin1String("*.xml"));
 
-    if (!url.isEmpty()) {
-        KIO::NetAccess::dircopy(QUrl::fromLocalFile(tf.fileName()), url, this);
+    if (url.isEmpty()) {
+        return;
+    }
+
+    KIO::StoredTransferJob *putJob = KIO::storedPut(&tf, url, -1);
+    KJobWidgets::setWindow(putJob, this);
+    if (!putJob->exec()) {
+        KMessageBox::sorry(this, i18n("Unable to store to '<b>%1</b>'.", 
url.toDisplayString()));
     }
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kwalletmanager-16.04.3/src/manager/kwalletmanagerwidget.cpp 
new/kwalletmanager-16.08.0/src/manager/kwalletmanagerwidget.cpp
--- old/kwalletmanager-16.04.3/src/manager/kwalletmanagerwidget.cpp     
2016-07-02 18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/src/manager/kwalletmanagerwidget.cpp     
2016-08-11 15:04:34.000000000 +0200
@@ -26,7 +26,6 @@
 #include <qurl.h>
 #include <kmessagebox.h>
 #include <klocalizedstring.h>
-#include <kio/netaccess.h>
 #include <QDragEnterEvent>
 
 KWalletManagerWidget::KWalletManagerWidget(QWidget *parent, Qt::WindowFlags 
flags):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/src/manager/kwhexview.cpp 
new/kwalletmanager-16.08.0/src/manager/kwhexview.cpp
--- old/kwalletmanager-16.04.3/src/manager/kwhexview.cpp        1970-01-01 
01:00:00.000000000 +0100
+++ new/kwalletmanager-16.08.0/src/manager/kwhexview.cpp        2016-08-11 
15:04:34.000000000 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2016  Rafał Rzepecki <[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) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "kwhexview.h"
+
+#include <qtextstream.h>
+#include <QTextCodec>
+
+KWHexView::KWHexView(QWidget* parent): QPlainTextEdit(parent)
+{
+    setReadOnly(true);
+    setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
+    setWordWrapMode(QTextOption::NoWrap);
+}
+
+enum { hexStride = 4 };
+
+template<class It>
+static QString toHex(It it, It end)
+{
+    QString text;
+    QTextStream ts(&text);
+
+    ts << hex << qSetFieldWidth(2) << qSetPadChar('0');
+
+    while (it < end) {
+        const auto sEnd = qMin(it + hexStride, end);
+        while (it < sEnd)
+            ts << static_cast<quint8>(*(it++));
+        ts << qSetFieldWidth(0) << " " << qSetFieldWidth(2);
+    }
+
+    return text;
+}
+
+template<class It>
+static QString toText(It begin, It end)
+{
+    QString text = QString::fromLatin1(begin, end - begin);
+
+    for (auto &ch: text)
+        if (!ch.isPrint()) ch = '.';
+
+    return text;
+}
+
+int KWHexView::calculateStride()
+{
+    const auto w = viewport()->width();
+    const auto em = fontMetrics().averageCharWidth();
+    const auto chars =  w / em - 1;
+    auto stride =  chars / 3 / hexStride * hexStride;
+
+    while (stride * 3 + (stride / hexStride) + 1 > chars)
+        stride -= hexStride;
+
+    return qMax(static_cast<int>(hexStride), stride);
+}
+
+void KWHexView::setData(const QByteArray& ba)
+{
+    data = ba;
+    showData();
+}
+
+void KWHexView::showData()
+{
+    QString text;
+    QTextStream ts(&text);
+    ts << left;
+
+    const auto stride = calculateStride();
+    const auto hexwidth = stride * 2 + (stride / hexStride) + 1;
+
+    for (auto it = data.begin(); it < data.end(); it += stride) {
+        auto end = qMin(it + stride, data.end());
+        ts << qSetFieldWidth(hexwidth) << toHex(it, end);
+        ts << qSetFieldWidth(0) << toText(it, end) << endl;
+    }
+
+    setPlainText(text);
+}
+
+void KWHexView::resizeEvent(QResizeEvent* e)
+{
+    QPlainTextEdit::resizeEvent(e);
+    if (e->size() != e->oldSize()) showData();
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/src/manager/kwhexview.h 
new/kwalletmanager-16.08.0/src/manager/kwhexview.h
--- old/kwalletmanager-16.04.3/src/manager/kwhexview.h  1970-01-01 
01:00:00.000000000 +0100
+++ new/kwalletmanager-16.08.0/src/manager/kwhexview.h  2016-08-11 
15:04:34.000000000 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016  Rafał Rzepecki <[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) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef KWHEXVIEW_H
+#define KWHEXVIEW_H
+
+#include <QPlainTextEdit>
+
+class KWHexView : public QPlainTextEdit
+{
+    Q_OBJECT
+
+public:
+    explicit KWHexView(QWidget* parent = nullptr);
+    void setData(const QByteArray &ba);
+
+protected:
+    void resizeEvent(QResizeEvent* e) override;
+
+private:
+    QByteArray data;
+
+    int calculateStride();
+    void showData();
+};
+
+#endif // KWHEXVIEW_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kwalletmanager-16.04.3/src/manager/walletwidget.ui 
new/kwalletmanager-16.08.0/src/manager/walletwidget.ui
--- old/kwalletmanager-16.04.3/src/manager/walletwidget.ui      2016-07-02 
18:03:10.000000000 +0200
+++ new/kwalletmanager-16.08.0/src/manager/walletwidget.ui      2016-08-11 
15:04:34.000000000 +0200
@@ -182,73 +182,43 @@
           </layout>
          </widget>
          <widget class="QWidget" name="page3"/>
-         <widget class="QWidget" name="page4">
+         <widget class="QWidget" name="binaryPage">
           <layout class="QVBoxLayout" name="verticalLayout">
            <item>
-            <spacer name="verticalSpacer">
-             <property name="orientation">
-              <enum>Qt::Vertical</enum>
+            <widget class="QCheckBox" name="_binaryViewShow">
+             <property name="text">
+              <string>Show &amp;Contents</string>
              </property>
-             <property name="sizeHint" stdset="0">
-              <size>
-               <width>20</width>
-               <height>40</height>
-              </size>
+             <property name="checked">
+              <bool>true</bool>
              </property>
-            </spacer>
+            </widget>
            </item>
            <item>
-            <layout class="QHBoxLayout" name="horizontalLayout">
-             <item>
-              <spacer name="horizontalSpacer_2">
-               <property name="orientation">
-                <enum>Qt::Horizontal</enum>
-               </property>
-               <property name="sizeHint" stdset="0">
-                <size>
-                 <width>40</width>
-                 <height>20</height>
-                </size>
-               </property>
-              </spacer>
-             </item>
-             <item>
-              <widget class="QLabel" name="textLabel1_2">
-               <property name="text">
-                <string>This is a binary data entry.  It cannot be edited as 
its format is unknown and application specific.</string>
-               </property>
-               <property name="alignment">
-                <set>Qt::AlignVCenter</set>
-               </property>
-               <property name="wordWrap">
-                <bool>true</bool>
-               </property>
-              </widget>
-             </item>
-             <item>
-              <spacer name="horizontalSpacer_3">
-               <property name="orientation">
-                <enum>Qt::Horizontal</enum>
-               </property>
-               <property name="sizeHint" stdset="0">
-                <size>
-                 <width>40</width>
-                 <height>20</height>
-                </size>
-               </property>
-              </spacer>
-             </item>
-            </layout>
+            <widget class="KWHexView" name="_binaryView">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+               <horstretch>0</horstretch>
+               <verstretch>1</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="readOnly">
+              <bool>true</bool>
+             </property>
+            </widget>
            </item>
            <item>
-            <spacer name="verticalSpacer_2">
+            <spacer name="verticalSpacer">
              <property name="orientation">
               <enum>Qt::Vertical</enum>
              </property>
+             <property name="sizeType">
+              <enum>QSizePolicy::Expanding</enum>
+             </property>
              <property name="sizeHint" stdset="0">
               <size>
                <width>20</width>
-               <height>40</height>
+               <height>0</height>
               </size>
              </property>
             </spacer>
@@ -356,10 +326,32 @@
    <extends>QLabel</extends>
    <header>ksqueezedtextlabel.h</header>
   </customwidget>
+  <customwidget>
+   <class>KWHexView</class>
+   <extends>QPlainTextEdit</extends>
+   <header>kwhexview.h</header>
+  </customwidget>
  </customwidgets>
  <includes>
   <include location="global">kiconloader.h</include>
  </includes>
  <resources/>
- <connections/>
+ <connections>
+  <connection>
+   <sender>_binaryViewShow</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>_binaryView</receiver>
+   <slot>setVisible(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>224</x>
+     <y>83</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>237</x>
+     <y>127</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
 </ui>


Reply via email to