Skip to content

Commit

Permalink
Add "Open Save Path" in tray (flameshot-org#3388)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexP11223 authored Nov 25, 2023
1 parent f04d22b commit 3d21e49
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/flameshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
#include <QApplication>
#include <QBuffer>
#include <QDebug>
#include <QDesktopServices>
#include <QDesktopWidget>
#include <QFile>
#include <QMessageBox>
#include <QThread>
#include <QTimer>
#include <QUrl>
#include <QVersionNumber>

#if defined(Q_OS_MACOS)
Expand Down Expand Up @@ -256,6 +258,14 @@ void Flameshot::history()
#endif
}

void Flameshot::openSavePath()
{
QString savePath = ConfigHandler().savePath();
if (!savePath.isEmpty()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(savePath));
}
}

QVersionNumber Flameshot::getVersion()
{
return QVersionNumber::fromString(
Expand Down
2 changes: 2 additions & 0 deletions src/core/flameshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public slots:
void info();
void history();

void openSavePath();

QVersionNumber getVersion();

public:
Expand Down
7 changes: 7 additions & 0 deletions src/widgets/trayicon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,17 @@ void TrayIcon::initMenu()
Flameshot::instance(),
&Flameshot::history);

auto* openSavePathAction = new QAction(tr("&Open Save Path"), this);
connect(openSavePathAction,
&QAction::triggered,
Flameshot::instance(),
&Flameshot::openSavePath);

m_menu->addAction(captureAction);
m_menu->addAction(launcherAction);
m_menu->addSeparator();
m_menu->addAction(recentAction);
m_menu->addAction(openSavePathAction);
m_menu->addSeparator();
m_menu->addAction(configAction);
m_menu->addSeparator();
Expand Down

0 comments on commit 3d21e49

Please sign in to comment.