Commit de73fcd9 authored by Ingemar Ceicer's avatar Ingemar Ceicer

Drag and drop works


Former-commit-id: 52d97e7f
parent e816aaeb
......@@ -27,6 +27,8 @@ Hash::Hash(QWidget *parent) :
{
/* draganddrop */
setAcceptDrops(true);
// QMessageBox::aboutQt(this, APPLICATION_NAME " " VERSION);
setStartConfig();
// File
......@@ -1398,6 +1400,7 @@ void Hash::checksum()
}
delete k;
bool lyckades = doChecksum(fileNames[0]);
// qDebug() << fileNames[0];
if ( lyckades == false )
QMessageBox::critical(this, APPLICATION_NAME " " VERSION,tr("No hash sum could be calculated"));
}
......@@ -3182,3 +3185,27 @@ QString Hash::getSystem()
v+=screen;
return v;
}
/* draganddrop */
void Hash::dropEvent(QDropEvent *ev)
{
QString surl;
QList<QUrl> urls = ev->mimeData()->urls();
foreach(QUrl url, urls)
{
surl = url.toString();
// qDebug()<<surl;
surl = QDir::toNativeSeparators(surl);
// qDebug()<<surl;
surl = surl.remove(0,7);
bool lyckades = doChecksum(surl);
// qDebug() << fileNames[0];
if ( lyckades == false )
QMessageBox::critical(this, APPLICATION_NAME " " VERSION,tr("No hash sum could be calculated"));
}
}
void Hash::dragEnterEvent(QDragEnterEvent *ev)
{
ev->accept();
}
......@@ -28,6 +28,11 @@
#include <QtWidgets>
#include <QTextCodec>
/* draganddrop */
#include <QDropEvent>
#include <QUrl>
#include <QDebug>
#define VERSION_PATH "http://bin.ceicer.com/hash/version.txt"
......@@ -75,6 +80,9 @@ public:
protected:
/* draganddrop */
void dropEvent(QDropEvent *ev);
void dragEnterEvent(QDragEnterEvent *ev);
private:
......
<!DOCTYPE RCC><RCC version="1.0">
<RCC>
<qresource>
<file>images/about.png</file>
<file>images/compare.png</file>
<file>images/copy.png</file>
<file>images/debian.png</file>
<file>images/english.png</file>
<file>images/exit.png</file>
<file>images/find.png</file>
<file>images/greek.png</file>
<file>images/hashsum.ico</file>
<file>images/hashsum.png</file>
<file>images/help.png</file>
<file>images/license.png</file>
<file>images/recent.png</file>
<file>images/swedish.png</file>
<file>images/tysk.png</file>
<file>images/update.png</file>
<file>images/versionhistory.png</file>
</qresource>
</RCC>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment