Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dschmidt/libcrashreporter-qt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Schmidt <dev@dominik-schmidt.de>2021-04-06 14:01:41 +0300
committerGitHub <noreply@github.com>2021-04-06 14:01:41 +0300
commit06f28a74433a461c5796765f08ade0491b4e1781 (patch)
tree2acbcebe24f7cb32c5ce43e9b14b6ba6f23b3f73
parent5423c0ef54f99cea2628c2cb3f48e39e215f9961 (diff)
parent60f13548198a19e468625768d2b0853f7fac88e3 (diff)
Merge pull request #25 from fmoc/clickable-crash-id
Make copying crash ID simple
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/libcrashreporter-gui/CrashReporter.cpp22
-rw-r--r--src/libcrashreporter-gui/CrashReporter.h1
3 files changed, 26 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1adc43c..9861aa6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,10 @@ if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
+if(POLICY CMP0063)
+ cmake_policy(SET CMP0063 NEW)
+endif()
+
option(ENABLE_GPL_CODE "Enable GPL-licensed depencencies of libcrashreporter-qt (dr.konqui integration)" OFF)
option(ENABLE_CRASH_REPORTER "Enable libcrashreporter-qt GUI component" ON)
diff --git a/src/libcrashreporter-gui/CrashReporter.cpp b/src/libcrashreporter-gui/CrashReporter.cpp
index d11b4ae..9f8891d 100644
--- a/src/libcrashreporter-gui/CrashReporter.cpp
+++ b/src/libcrashreporter-gui/CrashReporter.cpp
@@ -34,6 +34,9 @@
#include <QDir>
#include <QDateTime>
#include <QStandardPaths>
+#include <QClipboard>
+#include <QApplication>
+#include <QLabel>
// #include "utils/TomahawkUtils.h"
@@ -162,6 +165,10 @@ CrashReporter::CrashReporter( const QUrl& url, const QStringList& args )
m_ui->progressBar->setRange( 0, 0 );
}
#endif
+
+ // set up handler for clicked the link in the label that is used to let the user copy the crash ID easily
+ m_ui->progressLabel->setOpenExternalLinks(false);
+ connect(m_ui->progressLabel, &QLabel::linkActivated, this, &CrashReporter::onLinkClicked);
}
@@ -290,7 +297,7 @@ CrashReporter::onDone()
{
QString crashId = response.split("\n").at(0).split("=").at(1);
- m_ui->progressLabel->setText( tr( "Sent! <b>Many thanks</b>. Please refer to crash <b>%1</b> in bug reports." ).arg(crashId) );
+ m_ui->progressLabel->setText( tr( "Sent! <b>Many thanks</b>. Please refer to crash <a href=\"clipboard://%1\"><b>%1</b></a> (click to copy) in bug reports." ).arg(crashId) );
}
}
@@ -336,3 +343,16 @@ CrashReporter::setReportData(const QByteArray& name, const QByteArray& content,
m_formFileNames.insert( name, fileName );
}
}
+
+void
+CrashReporter::onLinkClicked(const QString& link)
+{
+ // we just have to handle clipboard "links", used to let the user copy the crash ID easily
+ // other links can be ignored
+ static const QString clipboardPrefix = "clipboard://";
+
+ if (link.startsWith(clipboardPrefix)) {
+ QString toCopyIntoClipboard = link.mid(clipboardPrefix.length());
+ QApplication::clipboard()->setText(toCopyIntoClipboard);
+ }
+}
diff --git a/src/libcrashreporter-gui/CrashReporter.h b/src/libcrashreporter-gui/CrashReporter.h
index 4a3bfa6..1da7b81 100644
--- a/src/libcrashreporter-gui/CrashReporter.h
+++ b/src/libcrashreporter-gui/CrashReporter.h
@@ -77,6 +77,7 @@ private slots:
void onProgress( qint64 done, qint64 total );
void onFail( int error, const QString& errorString );
void onSendButton();
+ void onLinkClicked(const QString& link);
};
#endif // CRASHREPORTER_H