Don't hardcode temp path
This commit is contained in:
@@ -92,10 +92,11 @@ AppLauncherWidget::AppLauncherWidget(const QPixmap &p, QWidget *parent):
|
||||
|
||||
void AppLauncherWidget::launch(const QModelIndex &index) {
|
||||
if (!QFileInfo(m_tempFile).isReadable()) {
|
||||
m_tempFile = FileNameHandler().generateAbsolutePath("/tmp") + ".png";
|
||||
m_tempFile = FileNameHandler().generateAbsolutePath(QDir::tempPath()) + ".png";
|
||||
bool ok = m_pixmap.save(m_tempFile);
|
||||
if (!ok) {
|
||||
QMessageBox::about(this, tr("Error"), tr("Unable to write in") + "/tmp.");
|
||||
QMessageBox::about(this, tr("Error"), tr("Unable to write in")
|
||||
+ QDir::tempPath());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusReply>
|
||||
#include <QDir>
|
||||
#endif
|
||||
|
||||
ScreenGrabber::ScreenGrabber(QObject *parent) : QObject(parent) {
|
||||
@@ -41,7 +42,7 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool &ok) {
|
||||
switch (m_info.windowManager()) {
|
||||
case m_info.GNOME: {
|
||||
// https://github.com/GNOME/gnome-shell/blob/695bfb96160033be55cfb5ac41c121998f98c328/data/org.gnome.Shell.Screenshot.xml
|
||||
QString path = FileNameHandler().generateAbsolutePath("/tmp") + ".png";
|
||||
QString path = FileNameHandler().generateAbsolutePath(QDir::tempPath()) + ".png";
|
||||
QDBusInterface gnomeInterface(QStringLiteral("org.gnome.Shell"),
|
||||
QStringLiteral("/org/gnome/Shell/Screenshot"),
|
||||
QStringLiteral("org.gnome.Shell.Screenshot"));
|
||||
|
||||
Reference in New Issue
Block a user