Copy file path (not url) on saving to disk
This commit is contained in:
@@ -380,6 +380,18 @@ void ConfigHandler::setCopyAndCloseAfterUploadEnabled(const bool value) {
|
||||
m_settings.setValue(QStringLiteral("copyAndCloseAfterUpload"), value);
|
||||
}
|
||||
|
||||
bool ConfigHandler::copyPathAfterSaveEnabled() {
|
||||
bool res = false;
|
||||
if (m_settings.contains(QStringLiteral("copyPathAfterSave"))) {
|
||||
res = m_settings.value(QStringLiteral("copyPathAfterSave")).toBool();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void ConfigHandler::setCopyPathAfterSaveEnabled(const bool value) {
|
||||
m_settings.setValue(QStringLiteral("copyPathAfterSave"), value);
|
||||
}
|
||||
|
||||
void ConfigHandler::setDefaults() {
|
||||
m_settings.clear();
|
||||
}
|
||||
|
||||
@@ -79,6 +79,9 @@ public:
|
||||
bool copyAndCloseAfterUploadEnabled();
|
||||
void setCopyAndCloseAfterUploadEnabled(const bool);
|
||||
|
||||
bool copyPathAfterSaveEnabled();
|
||||
void setCopyPathAfterSaveEnabled(const bool);
|
||||
|
||||
|
||||
void setDefaults();
|
||||
void setAllTheButtons();
|
||||
|
||||
@@ -79,9 +79,14 @@ bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap &capture) {
|
||||
ok = capture.save(savePath);
|
||||
|
||||
if (ok) {
|
||||
ConfigHandler config;
|
||||
QString pathNoFile = savePath.left(savePath.lastIndexOf(QLatin1String("/")));
|
||||
ConfigHandler().setSavePath(pathNoFile);
|
||||
config.setSavePath(pathNoFile);
|
||||
QString msg = QObject::tr("Capture saved as ") + savePath;
|
||||
if(config.copyPathAfterSaveEnabled()) {
|
||||
QApplication::clipboard()->setText(savePath);
|
||||
msg = QObject::tr("Capture saved and copied to the clipboard as ") + savePath;
|
||||
}
|
||||
SystemNotification().sendMessage(msg, savePath);
|
||||
} else {
|
||||
QString msg = QObject::tr("Error trying to save as ") + savePath;
|
||||
|
||||
Reference in New Issue
Block a user