summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index d70b57c..20e8554 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -13,8 +13,10 @@
**********************************************************************/
#include "screenshot.h"
#include <qapplication.h>
+#include <stdlib.h>
+
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpe/timestring.h>
@@ -22,9 +24,9 @@
#include <qpe/config.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
-
+#include <qdir.h>
#include <qfileinfo.h>
#include <qpoint.h>
#include <qpushbutton.h>
#include <qpainter.h>
@@ -126,9 +128,15 @@ void ScreenshotControl::savePixmap()
DocLnk lnk;
QString fileName = "sc_"+TimeString::dateString( QDateTime::currentDateTime(),false,true);
fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),"");
- fileName="/home/root/Documents/image/png/"+fileName+".png";
+ QString dirName = QDir::homeDirPath()+"/Documents/image/png/";
+ if( !QDir( dirName).exists() ) {
+ qDebug("making dir "+dirName);
+ QString msg = "mkdir -p "+dirName;
+ system(msg.latin1());
+ }
+ fileName=dirName+fileName+".png";
lnk.setFile(fileName); //sets File property
snapshot.save( fileName,"PNG");
qDebug("saving file "+fileName);
QFileInfo fi( fileName);