Show error message in KIO plugin

This commit is contained in:
Martchus 2017-03-27 11:12:06 +02:00
parent f5ee751374
commit 16cd445108
2 changed files with 11 additions and 3 deletions

View File

@ -18,6 +18,7 @@
#include <QWidget>
#include <QDir>
#include <QEvent>
#include <QMessageBox>
#include <iostream>
#include <functional>
@ -224,9 +225,16 @@ void SyncthingFileItemAction::logConnectionStatus()
cerr << "Syncthing connection status changed to: " << s_connection.statusText().toLocal8Bit().data() << endl;
}
void SyncthingFileItemAction::logConnectionError(const QString &errorMessage)
void SyncthingFileItemAction::logConnectionError(const QString &errorMessage, SyncthingErrorCategory errorCategory)
{
cerr << "Syncthing connection error: " << errorMessage.toLocal8Bit().data() << endl;
switch(errorCategory) {
case SyncthingErrorCategory::Parsing:
case SyncthingErrorCategory::SpecificRequest:
QMessageBox::critical(nullptr, tr("Syncthing connection error"), errorMessage);
break;
default:
cerr << "Syncthing connection error: " << errorMessage.toLocal8Bit().data() << endl;
}
}
void SyncthingFileItemAction::rescanDir(const QString &dirId, const QString &relpath)

View File

@ -60,7 +60,7 @@ public:
private Q_SLOTS:
static void logConnectionStatus();
static void logConnectionError(const QString &errorMessage);
static void logConnectionError(const QString &errorMessage, Data::SyncthingErrorCategory errorCategory);
static void rescanDir(const QString &dirId, const QString &relpath = QString());
static void showAboutDialog();