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 @@ #include <qmenubar.h> +#include <qmessagebox.h> @@ -162,3 +163,4 @@ TinyKate::~TinyKate( ) shutDown=true; - while (currentView!=0) { + while (currentView!=0) + { slotClose(); @@ -166,3 +168,4 @@ TinyKate::~TinyKate( ) - if( KGlobal::config() != 0 ) { + if( KGlobal::config() != 0 ) + { owarn << "deleting KateConfig object..\n" << oendl; @@ -176,3 +179,4 @@ void TinyKate::slotOpen( ) QString::null); - if (!filename.isEmpty()) { + if (!filename.isEmpty()) + { open(filename); @@ -185,9 +189,28 @@ void TinyKate::open(const QString & filename) KTextEditor::View *kv; - QFileInfo fi(filename); - QString filenamed = fi.fileName(); + QString realFileName; + //check if filename is a .desktop file + if ( filename.find( ".desktop", 0, true ) ) + { + switch ( QMessageBox::warning( this, tr( "TinyKATE" ), + tr("TinyKATE has detected<BR>you selected a <B>.desktop</B> file.<BR>Open <B>.desktop</B> file or <B>linked</B> file?" ), + tr(".desktop File"), + tr("Linked Document"), 0, 1, 1 ) ) + { + case 0: //desktop + realFileName = filename; + break; + case 1: //linked + DocLnk docLnk( filename ); + realFileName = docLnk.file(); + break; + }; + } + + QFileInfo fileInfo( realFileName ); + QString filenamed = fileInfo.fileName(); tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); - odebug << filename << oendl; + odebug << realFileName << oendl; kd->setDocName( filenamed); - kd->open( filename ); + kd->open( realFileName ); viewCount++; @@ -202,3 +225,4 @@ void TinyKate::slotCurrentChanged( QWidget * view) { - if (currentView) { + if (currentView) + { @@ -250,3 +274,4 @@ void TinyKate::slotClose( ) -void TinyKate::slotSave() { +void TinyKate::slotSave() +{ // feel free to make this how you want @@ -265,3 +290,4 @@ void TinyKate::slotSave() { -void TinyKate::slotSaveAs() { +void TinyKate::slotSaveAs() +{ if (currentView==0) return; @@ -271,3 +297,4 @@ void TinyKate::slotSaveAs() { QString::null); - if (!filename.isEmpty()) { + if (!filename.isEmpty()) + { odebug << "saving file "+filename << oendl; |