Diffstat (limited to 'noncore/apps/tinykate/tinykate.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
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 @@ -22,4 +22,5 @@ #include <qpe/resource.h> #include <qpe/global.h> +#include <qpe/qpeapplication.h> #include <opie/ofiledialog.h> @@ -38,5 +39,7 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) { + nextUnnamed=0; currentView=0; + viewCount=0; setCaption(tr("TinyKATE")); @@ -138,4 +141,7 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : utilSettings->addTo( popup); + if( qApp->argc() > 1) open(qApp->argv()[1]); + else slotNew(); + } @@ -145,10 +151,16 @@ 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++; } @@ -185,6 +197,6 @@ 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++; } @@ -196,4 +208,6 @@ void TinyKate::slotClose( ) tabwidget->removePage(dv); delete dv->document(); + viewCount--; + if (!viewCount) slotNew(); } |