author | llornkcor <llornkcor> | 2002-12-26 04:27:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-12-26 04:27:24 (UTC) |
commit | ec49b87e16b1a198847bd2511ebdccb5fdd3b2c5 (patch) (unidiff) | |
tree | 8708fc4a5374b8e3b95b40323c80b88bfe46846f /noncore | |
parent | df79efd854ebb22046e98b9076d31e94e2245ab2 (diff) | |
download | opie-ec49b87e16b1a198847bd2511ebdccb5fdd3b2c5.zip opie-ec49b87e16b1a198847bd2511ebdccb5fdd3b2c5.tar.gz opie-ec49b87e16b1a198847bd2511ebdccb5fdd3b2c5.tar.bz2 |
small fix for setting the directory in getOpenFileName, so it will return the fullpath
-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index 51afd31..6164fa5 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp | |||
@@ -142,41 +142,42 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
142 | 142 | ||
143 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); | 143 | utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); |
144 | utilSettings->addTo( popup); | 144 | utilSettings->addTo( popup); |
145 | 145 | ||
146 | if( qApp->argc() > 1) open(qApp->argv()[1]); | 146 | if( qApp->argc() > 1) open(qApp->argv()[1]); |
147 | else slotNew(); | 147 | else slotNew(); |
148 | 148 | ||
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | void TinyKate::slotOpen( ) | 152 | void TinyKate::slotOpen( ) |
153 | { | 153 | { |
154 | QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL); | 154 | QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
155 | if (!filename.isEmpty()) { | 155 | QPEApplication::documentDir()); |
156 | if (!filename.isEmpty()) { | ||
156 | open(filename); | 157 | open(filename); |
157 | } | 158 | } |
158 | } | 159 | } |
159 | 160 | ||
160 | void TinyKate::open(const QString & filename) | 161 | void TinyKate::open(const QString & filename) |
161 | { | 162 | { |
162 | KateDocument *kd= new KateDocument(false, false, this,0,this); | 163 | KateDocument *kd= new KateDocument(false, false, this,0,this); |
163 | KTextEditor::View *kv; | 164 | KTextEditor::View *kv; |
164 | QFileInfo fi(filename); | 165 | QFileInfo fi(filename); |
165 | QString filenamed = fi.fileName(); | 166 | QString filenamed = fi.fileName(); |
166 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); | 167 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); |
167 | qDebug(filename); | 168 | qDebug(filename); |
168 | 169 | ||
169 | kd->setDocName( filenamed); | 170 | kd->setDocName( filenamed); |
170 | kd->open(filename); | 171 | kd->open( filename ); |
171 | viewCount++; | 172 | viewCount++; |
172 | } | 173 | } |
173 | 174 | ||
174 | void TinyKate::slotCurrentChanged( QWidget * view) | 175 | void TinyKate::slotCurrentChanged( QWidget * view) |
175 | { | 176 | { |
176 | if (currentView) { | 177 | if (currentView) { |
177 | 178 | ||
178 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); | 179 | disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); |
179 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); | 180 | disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); |
180 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); | 181 | disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); |
181 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); | 182 | disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); |
182 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); | 183 | disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); |
@@ -231,25 +232,26 @@ void TinyKate::slotSave() { | |||
231 | if( kd->docName().isEmpty()) | 232 | if( kd->docName().isEmpty()) |
232 | slotSaveAs(); | 233 | slotSaveAs(); |
233 | else | 234 | else |
234 | kd->saveFile(); | 235 | kd->saveFile(); |
235 | // kv->save(); | 236 | // kv->save(); |
236 | // kd->saveFile(); | 237 | // kd->saveFile(); |
237 | } | 238 | } |
238 | 239 | ||
239 | void TinyKate::slotSaveAs() { | 240 | void TinyKate::slotSaveAs() { |
240 | if (currentView==0) return; | 241 | if (currentView==0) return; |
241 | KateDocument *kd = (KateDocument*) currentView->document(); | 242 | KateDocument *kd = (KateDocument*) currentView->document(); |
242 | 243 | ||
243 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL); | 244 | QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, |
245 | QPEApplication::documentDir()); | ||
244 | if (!filename.isEmpty()) { | 246 | if (!filename.isEmpty()) { |
245 | qDebug("saving file "+filename); | 247 | qDebug("saving file "+filename); |
246 | QFileInfo fi(filename); | 248 | QFileInfo fi(filename); |
247 | QString filenamed = fi.fileName(); | 249 | QString filenamed = fi.fileName(); |
248 | kd->setDocFile( filename); | 250 | kd->setDocFile( filename); |
249 | kd->setDocName( filenamed); | 251 | kd->setDocName( filenamed); |
250 | kd->saveFile(); | 252 | kd->saveFile(); |
251 | // KTextEditor::View *dv = currentView; | 253 | // KTextEditor::View *dv = currentView; |
252 | // tabwidget->changeTab( dv, filenamed); | 254 | // tabwidget->changeTab( dv, filenamed); |
253 | // need to change tab label here | 255 | // need to change tab label here |
254 | } | 256 | } |
255 | 257 | ||