summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-09 04:13:08 (UTC)
committer llornkcor <llornkcor>2002-02-09 04:13:08 (UTC)
commit864a3a1dc5bdcae601626aa1f6b3cf8e85385cf3 (patch) (side-by-side diff)
tree6f6f181c0730982e58166309323dfcbb718e6e1f
parentb440f07b1f20877618e33248a65bf069150d72c4 (diff)
downloadopie-864a3a1dc5bdcae601626aa1f6b3cf8e85385cf3.zip
opie-864a3a1dc5bdcae601626aa1f6b3cf8e85385cf3.tar.gz
opie-864a3a1dc5bdcae601626aa1f6b3cf8e85385cf3.tar.bz2
uses $HOME
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 @@
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "screenshot.h"
#include <qapplication.h>
+#include <stdlib.h>
+
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qpe/timestring.h>
#include <qpe/resource.h>
#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>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qslider.h>
#include <qlayout.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qstring.h>
#include <qfile.h>
@@ -118,25 +120,31 @@ void ScreenshotControl::slotGrab()
void ScreenshotControl::grabTimerDone()
{
performGrab();
}
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);
lnk.setName( fi.fileName()); //sets file name
if(!lnk.writeLink())
qDebug("Writing doclink did not work");
QPEApplication::beep();
}