Skip to content

Commit 3d21e49

Browse files
authored
Add "Open Save Path" in tray (flameshot-org#3388)
1 parent f04d22b commit 3d21e49

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/core/flameshot.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
#include <QApplication>
2525
#include <QBuffer>
2626
#include <QDebug>
27+
#include <QDesktopServices>
2728
#include <QDesktopWidget>
2829
#include <QFile>
2930
#include <QMessageBox>
3031
#include <QThread>
3132
#include <QTimer>
33+
#include <QUrl>
3234
#include <QVersionNumber>
3335

3436
#if defined(Q_OS_MACOS)
@@ -256,6 +258,14 @@ void Flameshot::history()
256258
#endif
257259
}
258260

261+
void Flameshot::openSavePath()
262+
{
263+
QString savePath = ConfigHandler().savePath();
264+
if (!savePath.isEmpty()) {
265+
QDesktopServices::openUrl(QUrl::fromLocalFile(savePath));
266+
}
267+
}
268+
259269
QVersionNumber Flameshot::getVersion()
260270
{
261271
return QVersionNumber::fromString(

src/core/flameshot.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public slots:
4242
void info();
4343
void history();
4444

45+
void openSavePath();
46+
4547
QVersionNumber getVersion();
4648

4749
public:

src/widgets/trayicon.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,17 @@ void TrayIcon::initMenu()
156156
Flameshot::instance(),
157157
&Flameshot::history);
158158

159+
auto* openSavePathAction = new QAction(tr("&Open Save Path"), this);
160+
connect(openSavePathAction,
161+
&QAction::triggered,
162+
Flameshot::instance(),
163+
&Flameshot::openSavePath);
164+
159165
m_menu->addAction(captureAction);
160166
m_menu->addAction(launcherAction);
161167
m_menu->addSeparator();
162168
m_menu->addAction(recentAction);
169+
m_menu->addAction(openSavePathAction);
163170
m_menu->addSeparator();
164171
m_menu->addAction(configAction);
165172
m_menu->addSeparator();

0 commit comments

Comments
 (0)