summaryrefslogtreecommitdiff
path: root/noncore
authorar <ar>2004-06-20 21:17:00 (UTC)
committer ar <ar>2004-06-20 21:17:00 (UTC)
commit526031c34fff4e789b05fddbd7effe83ef057361 (patch) (side-by-side diff)
tree23146566d3d27ba9648d5a8e0500d6b41c6ac9f9 /noncore
parentf12be4d4ffaf6b5542b270c7d18fbb7141711309 (diff)
downloadopie-526031c34fff4e789b05fddbd7effe83ef057361.zip
opie-526031c34fff4e789b05fddbd7effe83ef057361.tar.gz
opie-526031c34fff4e789b05fddbd7effe83ef057361.tar.bz2
- BUGFIX: 0001291 - opie tinykate does not open .desktop files
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/tinykate/mainwindow/tinykate.cpp49
-rw-r--r--noncore/apps/tinykate/mainwindow/tinykate.h0
2 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
@@ -30,6 +30,7 @@
#include <qaction.h>
#include <qtoolbutton.h>
#include <qmenubar.h>
+#include <qmessagebox.h>
using namespace Opie::Ui;
@@ -160,11 +161,13 @@ TinyKate::~TinyKate( )
owarn << "TinyKate destructor\n" << oendl;
shutDown=true;
- while (currentView!=0) {
+ while (currentView!=0)
+ {
slotClose();
}
- if( KGlobal::config() != 0 ) {
+ if( KGlobal::config() != 0 )
+ {
owarn << "deleting KateConfig object..\n" << oendl;
delete KGlobal::config();
}
@@ -174,7 +177,8 @@ void TinyKate::slotOpen( )
{
QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
QString::null);
- if (!filename.isEmpty()) {
+ if (!filename.isEmpty())
+ {
open(filename);
}
}
@@ -183,13 +187,32 @@ void TinyKate::open(const QString & filename)
{
KateDocument *kd= new KateDocument(false, false, this,0,this);
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++;
}
@@ -200,7 +223,8 @@ void TinyKate::setDocument(const QString& fileref)
void TinyKate::slotCurrentChanged( QWidget * view)
{
- if (currentView) {
+ if (currentView)
+ {
disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy()));
disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut()));
@@ -248,7 +272,8 @@ void TinyKate::slotClose( )
if ((!viewCount) && (!shutDown)) slotNew();
}
-void TinyKate::slotSave() {
+void TinyKate::slotSave()
+{
// feel free to make this how you want
if (currentView==0) return;
@@ -263,13 +288,15 @@ void TinyKate::slotSave() {
// kd->saveFile();
}
-void TinyKate::slotSaveAs() {
+void TinyKate::slotSaveAs()
+{
if (currentView==0) return;
KateDocument *kd = (KateDocument*) currentView->document();
QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL,
QString::null);
- if (!filename.isEmpty()) {
+ if (!filename.isEmpty())
+ {
odebug << "saving file "+filename << oendl;
QFileInfo fi(filename);
QString filenamed = fi.fileName();
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.h b/noncore/apps/tinykate/mainwindow/tinykate.h
index f435c03..f630f62 100644
--- a/noncore/apps/tinykate/mainwindow/tinykate.h
+++ b/noncore/apps/tinykate/mainwindow/tinykate.h