summaryrefslogtreecommitdiff
path: root/core/applets/screenshotapplet
Side-by-side diff
Diffstat (limited to 'core/applets/screenshotapplet') (more/less context) (show whitespace changes)
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 9aa012a..938ea0c 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -13,15 +13,18 @@
**********************************************************************/
#include "screenshot.h"
#include "inputDialog.h"
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/otaskbarapplet.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
/* QT */
#include <qlineedit.h>
#include <qdir.h>
#include <qlabel.h>
#include <qpushbutton.h>
@@ -36,13 +39,12 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
/* XPM */
-using namespace Opie::Ui;
static char * snapshot_xpm[] = {
"32 32 177 2",
" c None",
". c #042045",
"+ c #0D2B47",
"@ c #0E325E",
@@ -359,57 +361,57 @@ void ScreenshotControl::savePixmap()
//not sure why this is needed here, but it forgets fileName
// if this is below the braces
if (fileName.right(3) != "png")
fileName = fileName + ".png";
lnk.setFile(fileName); //sets File property
- qDebug("saving file " + fileName);
+ odebug << "saving file " + fileName << oendl;
snapshot.save( fileName, "PNG");
QFileInfo fi( fileName);
lnk.setName( fi.fileName()); //sets file name
if (!lnk.writeLink())
- qDebug("Writing doclink did not work");
+ odebug << "Writing doclink did not work" << oendl;
}
else {
fileName = "sc_" + QDateTime::currentDateTime().toString();
fileName.replace(QRegExp("'"), "");
fileName.replace(QRegExp(" "), "_");
fileName.replace(QRegExp(":"), ".");
fileName.replace(QRegExp(","), "");
QString dirName = QDir::homeDirPath() + "/Documents/image/png/";
if ( !QDir( dirName).exists() ) {
- qDebug("making dir " + dirName);
+ odebug << "making dir " + dirName << oendl;
QString msg = "mkdir -p " + dirName;
system(msg.latin1());
}
fileName = dirName + fileName;
if (fileName.right(3) != "png")
fileName = fileName + ".png";
lnk.setFile(fileName); //sets File property
- qDebug("saving file " + fileName);
+ odebug << "saving file " + fileName << oendl;
snapshot.save( fileName, "PNG");
QFileInfo fi( fileName);
lnk.setName( fi.fileName()); //sets file name
if (!lnk.writeLink())
- qDebug("Writing doclink did not work");
+ odebug << "Writing doclink did not work" << oendl;
}
QPEApplication::beep();
}
void ScreenshotControl::performGrab()
{
snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height() );
if (buttonPushed == 1) {
- qDebug("grabbing screen");
+ odebug << "grabbing screen" << oendl;
grabTimer->stop();
show();
qApp->processEvents();
savePixmap();
} else {
grabTimer->stop();
@@ -417,13 +419,13 @@ void ScreenshotControl::performGrab()
struct sockaddr_in raddr;
struct hostent *rhost_info;
int sock = -1;
bool ok = false;
QString displayEnv = getenv("QWS_DISPLAY");
- qDebug(displayEnv);
+ odebug << displayEnv << oendl;
if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) {
if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) {
::memset ( &raddr, 0, sizeof (struct sockaddr_in));
::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length );
@@ -454,13 +456,13 @@ void ScreenshotControl::performGrab()
"Content-Type: image/png\n"
"Host: %4\n" // 4: scap host
"\n";
header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname );
- qDebug(header);
+ odebug << header << oendl;
if ( !pix.isNull() ) {
const char *ascii = header.latin1( );
uint ascii_len = ::strlen( ascii );
::write ( sock, ascii, ascii_len );
::write ( sock, img.bits(), img.numBytes() );