From 0f9ce3f60b6fbd350f79485ee8fc5fe37be692e1 Mon Sep 17 00:00:00 2001 From: jowenn Date: Fri, 22 Nov 2002 21:18:23 +0000 Subject: Show icons --- (limited to 'noncore/apps/tinykate/tinykate.cpp') diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index 03c6e50..f177e47 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -36,8 +37,10 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) -{ +{ + nextUnnamed=0; currentView=0; + viewCount=0; setCaption(tr("TinyKATE")); setToolBarsMovable(FALSE); @@ -137,6 +140,9 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); utilSettings->addTo( popup); + if( qApp->argc() > 1) open(qApp->argv()[1]); + else slotNew(); + } @@ -144,12 +150,18 @@ void TinyKate::slotOpen( ) { QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED_ALL); if (!filename.isEmpty()) { + open(filename); + } +} + +void TinyKate::open(const QString & filename) +{ KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; - tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"BLAH","BLAH"); + tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate","BLAH"); qDebug(filename); kd->open(filename); - } + viewCount++; } void TinyKate::slotCurrentChanged( QWidget * view) @@ -184,8 +196,8 @@ void TinyKate::slotNew( ) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; - tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"),"BLAH",tr("Unnamed %1").arg(0)); - + tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"),"tinykate/tinykate",tr("Unnamed %1").arg(nextUnnamed++)); + viewCount++; } void TinyKate::slotClose( ) @@ -195,5 +207,7 @@ void TinyKate::slotClose( ) currentView=0; tabwidget->removePage(dv); delete dv->document(); + viewCount--; + if (!viewCount) slotNew(); } -- cgit v0.9.0.2