-rw-r--r-- | core/applets/screenshotapplet/screenshot.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp index 98f2c9e..266d6d8 100644 --- a/core/applets/screenshotapplet/screenshot.cpp +++ b/core/applets/screenshotapplet/screenshot.cpp | |||
@@ -115,96 +115,98 @@ ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | |||
115 | 115 | ||
116 | 116 | ||
117 | scapButton = new QPushButton( this, "ScapButton" ); | 117 | scapButton = new QPushButton( this, "ScapButton" ); |
118 | 118 | ||
119 | scapButton ->setFocusPolicy( QWidget::TabFocus ); | 119 | scapButton ->setFocusPolicy( QWidget::TabFocus ); |
120 | scapButton ->setText(tr("scap")); | 120 | scapButton ->setText(tr("scap")); |
121 | if( !QFile("/usr/bin/nc").exists()) | 121 | if( !QFile("/usr/bin/nc").exists()) |
122 | scapButton->hide(); | 122 | scapButton->hide(); |
123 | 123 | ||
124 | hbox->addWidget( grabItButton); | 124 | hbox->addWidget( grabItButton); |
125 | QSpacerItem* spacer2 = new QSpacerItem( 4, 4, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 125 | QSpacerItem* spacer2 = new QSpacerItem( 4, 4, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
126 | hbox->addItem( spacer2 ); | 126 | hbox->addItem( spacer2 ); |
127 | hbox->addWidget( scapButton); | 127 | hbox->addWidget( scapButton); |
128 | 128 | ||
129 | vbox->addItem(hbox); | 129 | vbox->addItem(hbox); |
130 | 130 | ||
131 | setFixedHeight( 100 ); | 131 | setFixedHeight( 100 ); |
132 | setFixedWidth( sizeHint().width() ); | 132 | setFixedWidth( sizeHint().width() ); |
133 | setFocusPolicy(QWidget::NoFocus); | 133 | setFocusPolicy(QWidget::NoFocus); |
134 | 134 | ||
135 | grabTimer= new QTimer(this,"grab timer"); | 135 | grabTimer= new QTimer(this,"grab timer"); |
136 | connect( grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); | 136 | connect( grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); |
137 | 137 | ||
138 | delaySpin->setValue(1); | 138 | delaySpin->setValue(1); |
139 | connect( grabItButton, SIGNAL(released()), SLOT(slotGrab()) ); | 139 | connect( grabItButton, SIGNAL(released()), SLOT(slotGrab()) ); |
140 | connect( scapButton, SIGNAL(released()), SLOT(slotScap()) ); | 140 | connect( scapButton, SIGNAL(released()), SLOT(slotScap()) ); |
141 | connect(saveNamedCheck, SIGNAL(toggled( bool)), this, SLOT( nameScreenshot(bool)) ); | 141 | connect(saveNamedCheck, SIGNAL(toggled( bool)), this, SLOT( nameScreenshot(bool)) ); |
142 | } | 142 | } |
143 | 143 | ||
144 | void ScreenshotControl::slotGrab() { | 144 | void ScreenshotControl::slotGrab() { |
145 | // qDebug("SlotGrab"); | 145 | // qDebug("SlotGrab"); |
146 | buttonPushed=1; | 146 | buttonPushed=1; |
147 | hide(); | 147 | hide(); |
148 | setFileName=FALSE; | 148 | setFileName=FALSE; |
149 | if( saveNamedCheck->isChecked()) { | 149 | if( saveNamedCheck->isChecked()) { |
150 | setFileName=TRUE; | 150 | setFileName=TRUE; |
151 | // qDebug("checked"); | 151 | // qDebug("checked"); |
152 | InputDialog *fileDlg; | 152 | InputDialog *fileDlg; |
153 | 153 | ||
154 | fileDlg = new InputDialog( 0 ,tr("Name of screenshot "),TRUE, 0); | 154 | fileDlg = new InputDialog( 0 ,tr("Name of screenshot "),TRUE, 0); |
155 | fileDlg->exec(); | 155 | fileDlg->exec(); |
156 | fileDlg->raise(); | 156 | fileDlg->raise(); |
157 | QString fileName,list; | 157 | QString fileName,list; |
158 | if( fileDlg->result() == 1 ) { | 158 | if( fileDlg->result() == 1 ) { |
159 | fileName = fileDlg->LineEdit1->text(); | 159 | fileName = fileDlg->LineEdit1->text(); |
160 | 160 | ||
161 | if(fileName.find("/",0,TRUE)==-1) | 161 | if(fileName.find("/",0,TRUE)==-1) |
162 | FileNamePath = QDir::homeDirPath()+"/Documents/image/png/"+fileName; | 162 | FileNamePath = QDir::homeDirPath()+"/Documents/image/png/"+fileName; |
163 | else | ||
164 | FileNamePath = fileName; | ||
163 | // qDebug(fileName); | 165 | // qDebug(fileName); |
164 | 166 | ||
165 | } | 167 | } |
166 | delete fileDlg; | 168 | delete fileDlg; |
167 | } | 169 | } |
168 | if ( delaySpin->value() ) { | 170 | if ( delaySpin->value() ) { |
169 | grabTimer->start( delaySpin->value() * 1000, true ); | 171 | grabTimer->start( delaySpin->value() * 1000, true ); |
170 | } else { | 172 | } else { |
171 | show(); | 173 | show(); |
172 | } | 174 | } |
173 | } | 175 | } |
174 | 176 | ||
175 | void ScreenshotControl::slotScap() { | 177 | void ScreenshotControl::slotScap() { |
176 | buttonPushed=2; | 178 | buttonPushed=2; |
177 | hide(); | 179 | hide(); |
178 | if ( delaySpin->value() ) { | 180 | if ( delaySpin->value() ) { |
179 | grabTimer->start( delaySpin->value() * 1000, true ); | 181 | grabTimer->start( delaySpin->value() * 1000, true ); |
180 | } else { | 182 | } else { |
181 | show(); | 183 | show(); |
182 | } | 184 | } |
183 | } | 185 | } |
184 | 186 | ||
185 | 187 | ||
186 | void ScreenshotControl::grabTimerDone() { | 188 | void ScreenshotControl::grabTimerDone() { |
187 | performGrab(); | 189 | performGrab(); |
188 | } | 190 | } |
189 | 191 | ||
190 | void ScreenshotControl::savePixmap() { | 192 | void ScreenshotControl::savePixmap() { |
191 | DocLnk lnk; | 193 | DocLnk lnk; |
192 | QString fileName; | 194 | QString fileName; |
193 | 195 | ||
194 | if( setFileName) { | 196 | if( setFileName) { |
195 | fileName=FileNamePath; | 197 | fileName=FileNamePath; |
196 | //not sure why this is needed here, but it forgets fileName | 198 | //not sure why this is needed here, but it forgets fileName |
197 | // if this is below the braces | 199 | // if this is below the braces |
198 | 200 | ||
199 | if(fileName.right(3)!="png") | 201 | if(fileName.right(3)!="png") |
200 | fileName=fileName+".png"; | 202 | fileName=fileName+".png"; |
201 | lnk.setFile(fileName); //sets File property | 203 | lnk.setFile(fileName); //sets File property |
202 | qDebug("saving file "+fileName); | 204 | qDebug("saving file "+fileName); |
203 | snapshot.save( fileName,"PNG"); | 205 | snapshot.save( fileName,"PNG"); |
204 | QFileInfo fi( fileName); | 206 | QFileInfo fi( fileName); |
205 | lnk.setName( fi.fileName()); //sets file name | 207 | lnk.setName( fi.fileName()); //sets file name |
206 | 208 | ||
207 | if(!lnk.writeLink()) | 209 | if(!lnk.writeLink()) |
208 | qDebug("Writing doclink did not work"); | 210 | qDebug("Writing doclink did not work"); |
209 | } else { | 211 | } else { |
210 | 212 | ||