summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/mainwindow/tinykate.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp
index bbb0be7e..e808a2e 100644
--- a/noncore/apps/tinykate/mainwindow/tinykate.cpp
+++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp
@@ -158,111 +158,112 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
hlmenu->insertItem(hlm->hlName(i),i);
}
popup->insertItem(tr("Highlighting"),hlmenu);
utilSettings = new QAction( tr( "Settings" ),
Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
utilSettings->addTo( popup);
if( qApp->argc() > 1) open(qApp->argv()[1]);
else slotNew();
}
TinyKate::~TinyKate( )
{
owarn << "TinyKate destructor\n" << oendl;
shutDown=true;
while (currentView!=0)
{
slotClose();
}
if( KGlobal::config() != 0 )
{
owarn << "deleting KateConfig object..\n" << oendl;
delete KGlobal::config();
}
}
void TinyKate::slotOpen( )
{
QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
QString::null);
if (!filename.isEmpty())
{
open(filename);
}
}
void TinyKate::open(const QString & filename)
{
KateDocument *kd= new KateDocument(false, false, this,0,this);
KTextEditor::View *kv;
QString realFileName;
//check if filename is a .desktop file
- if ( filename.find( ".desktop", 0, true ) )
- {
+ if ( filename.find( ".desktop", 0, true ) != -1 ) {
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;
};
+ } else {
+ realFileName = filename;
}
QFileInfo fileInfo( realFileName );
QString filenamed = fileInfo.fileName();
tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
odebug << realFileName << oendl;
kd->setDocName( filenamed);
kd->open( realFileName );
viewCount++;
}
void TinyKate::setDocument(const QString& fileref)
{
open( fileref );
}
void TinyKate::slotCurrentChanged( QWidget * view)
{
if (currentView)
{
disconnect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
disconnect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
}
currentView=(KTextEditor::View*)view;
connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy()));
connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut()));
connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste()));
connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo()));
connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo()));
connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes()));
connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes()));
connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int)));
connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog()));
}
void TinyKate::slotNew( )