summaryrefslogtreecommitdiff
Unidiff
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
@@ -5,34 +5,36 @@
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "screenshot.h" 15#include "screenshot.h"
16#include <qapplication.h> 16#include <qapplication.h>
17#include <stdlib.h>
18
17 19
18#include <qpe/resource.h> 20#include <qpe/resource.h>
19#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
20#include <qpe/timestring.h> 22#include <qpe/timestring.h>
21#include <qpe/resource.h> 23#include <qpe/resource.h>
22#include <qpe/config.h> 24#include <qpe/config.h>
23#include <qpe/applnk.h> 25#include <qpe/applnk.h>
24#include <qpe/config.h> 26#include <qpe/config.h>
25 27
26 28#include <qdir.h>
27#include <qfileinfo.h> 29#include <qfileinfo.h>
28#include <qpoint.h> 30#include <qpoint.h>
29#include <qpushbutton.h> 31#include <qpushbutton.h>
30#include <qpainter.h> 32#include <qpainter.h>
31#include <qcombobox.h> 33#include <qcombobox.h>
32#include <qspinbox.h> 34#include <qspinbox.h>
33#include <qslider.h> 35#include <qslider.h>
34#include <qlayout.h> 36#include <qlayout.h>
35#include <qframe.h> 37#include <qframe.h>
36#include <qpixmap.h> 38#include <qpixmap.h>
37#include <qstring.h> 39#include <qstring.h>
38#include <qfile.h> 40#include <qfile.h>
@@ -118,25 +120,31 @@ void ScreenshotControl::slotGrab()
118 120
119void ScreenshotControl::grabTimerDone() 121void ScreenshotControl::grabTimerDone()
120{ 122{
121 performGrab(); 123 performGrab();
122} 124}
123 125
124void ScreenshotControl::savePixmap() 126void ScreenshotControl::savePixmap()
125{ 127{
126 DocLnk lnk; 128 DocLnk lnk;
127 QString fileName = "sc_"+TimeString::dateString( QDateTime::currentDateTime(),false,true); 129 QString fileName = "sc_"+TimeString::dateString( QDateTime::currentDateTime(),false,true);
128 fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),""); 130 fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),"");
129 131
130 fileName="/home/root/Documents/image/png/"+fileName+".png"; 132 QString dirName = QDir::homeDirPath()+"/Documents/image/png/";
133 if( !QDir( dirName).exists() ) {
134 qDebug("making dir "+dirName);
135 QString msg = "mkdir -p "+dirName;
136 system(msg.latin1());
137 }
138 fileName=dirName+fileName+".png";
131 lnk.setFile(fileName); //sets File property 139 lnk.setFile(fileName); //sets File property
132 snapshot.save( fileName,"PNG"); 140 snapshot.save( fileName,"PNG");
133 qDebug("saving file "+fileName); 141 qDebug("saving file "+fileName);
134 QFileInfo fi( fileName); 142 QFileInfo fi( fileName);
135 lnk.setName( fi.fileName()); //sets file name 143 lnk.setName( fi.fileName()); //sets file name
136 if(!lnk.writeLink()) 144 if(!lnk.writeLink())
137 qDebug("Writing doclink did not work"); 145 qDebug("Writing doclink did not work");
138 146
139 QPEApplication::beep(); 147 QPEApplication::beep();
140 148
141} 149}
142 150