Diffstat (limited to 'noncore/apps/tinykate/mainwindow/tinykate.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/mainwindow/tinykate.cpp | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp index 9865c35..30c07fc 100644 --- a/noncore/apps/tinykate/mainwindow/tinykate.cpp +++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp | |||
@@ -32,2 +32,3 @@ | |||
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qmessagebox.h> | ||
33 | 34 | ||
@@ -162,3 +163,4 @@ TinyKate::~TinyKate( ) | |||
162 | shutDown=true; | 163 | shutDown=true; |
163 | while (currentView!=0) { | 164 | while (currentView!=0) |
165 | { | ||
164 | slotClose(); | 166 | slotClose(); |
@@ -166,3 +168,4 @@ TinyKate::~TinyKate( ) | |||
166 | 168 | ||
167 | if( KGlobal::config() != 0 ) { | 169 | if( KGlobal::config() != 0 ) |
170 | { | ||
168 | owarn << "deleting KateConfig object..\n" << oendl; | 171 | owarn << "deleting KateConfig object..\n" << oendl; |
@@ -176,3 +179,4 @@ void TinyKate::slotOpen( ) | |||
176 | QString::null); | 179 | QString::null); |
177 | if (!filename.isEmpty()) { | 180 | if (!filename.isEmpty()) |
181 | { | ||
178 | open(filename); | 182 | open(filename); |
@@ -185,9 +189,28 @@ void TinyKate::open(const QString & filename) | |||
185 | KTextEditor::View *kv; | 189 | KTextEditor::View *kv; |
186 | QFileInfo fi(filename); | 190 | QString realFileName; |
187 | QString filenamed = fi.fileName(); | 191 | //check if filename is a .desktop file |
192 | if ( filename.find( ".desktop", 0, true ) ) | ||
193 | { | ||
194 | switch ( QMessageBox::warning( this, tr( "TinyKATE" ), | ||
195 | tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ), | ||
196 | tr(".desktop File"), | ||
197 | tr("Linked Document"), 0, 1, 1 ) ) | ||
198 | { | ||
199 | case 0: //desktop | ||
200 | realFileName = filename; | ||
201 | break; | ||
202 | case 1: //linked | ||
203 | DocLnk docLnk( filename ); | ||
204 | realFileName = docLnk.file(); | ||
205 | break; | ||
206 | }; | ||
207 | } | ||
208 | |||
209 | QFileInfo fileInfo( realFileName ); | ||
210 | QString filenamed = fileInfo.fileName(); | ||
188 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); | 211 | tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); |
189 | odebug << filename << oendl; | 212 | odebug << realFileName << oendl; |
190 | 213 | ||
191 | kd->setDocName( filenamed); | 214 | kd->setDocName( filenamed); |
192 | kd->open( filename ); | 215 | kd->open( realFileName ); |
193 | viewCount++; | 216 | viewCount++; |
@@ -202,3 +225,4 @@ void TinyKate::slotCurrentChanged( QWidget * view) | |||
202 | { | 225 | { |
203 | if (currentView) { | 226 | if (currentView) |
227 | { | ||
204 | 228 | ||
@@ -250,3 +274,4 @@ void TinyKate::slotClose( ) | |||
250 | 274 | ||
251 | void TinyKate::slotSave() { | 275 | void TinyKate::slotSave() |
276 | { | ||
252 | // feel free to make this how you want | 277 | // feel free to make this how you want |
@@ -265,3 +290,4 @@ void TinyKate::slotSave() { | |||
265 | 290 | ||
266 | void TinyKate::slotSaveAs() { | 291 | void TinyKate::slotSaveAs() |
292 | { | ||
267 | if (currentView==0) return; | 293 | if (currentView==0) return; |
@@ -271,3 +297,4 @@ void TinyKate::slotSaveAs() { | |||
271 | QString::null); | 297 | QString::null); |
272 | if (!filename.isEmpty()) { | 298 | if (!filename.isEmpty()) |
299 | { | ||
273 | odebug << "saving file "+filename << oendl; | 300 | odebug << "saving file "+filename << oendl; |