summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/tinykate.cpp24
-rw-r--r--noncore/apps/tinykate/tinykate.h9
2 files changed, 25 insertions, 8 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
@@ -23,2 +23,3 @@
#include <qpe/global.h>
+#include <qpe/qpeapplication.h>
@@ -38,4 +39,6 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
QMainWindow( parent, name, f )
-{
+{
+ nextUnnamed=0;
currentView=0;
+ viewCount=0;
setCaption(tr("TinyKATE"));
@@ -139,2 +142,5 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
+ if( qApp->argc() > 1) open(qApp->argv()[1]);
+ else slotNew();
+
}
@@ -146,8 +152,14 @@ void TinyKate::slotOpen( )
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++;
}
@@ -186,4 +198,4 @@ void TinyKate::slotNew( )
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++;
}
@@ -197,2 +209,4 @@ void TinyKate::slotClose( )
delete dv->document();
+ viewCount--;
+ if (!viewCount) slotNew();
}
diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h
index 6dda05d..ef0dcba 100644
--- a/noncore/apps/tinykate/tinykate.h
+++ b/noncore/apps/tinykate/tinykate.h
@@ -35,6 +35,6 @@ public:
public slots:
- void slotOpen();
+ void slotNew();
protected slots:
- void slotNew();
+ void slotOpen();
void slotClose();
@@ -42,2 +42,4 @@ protected slots:
+protected:
+ void open(const QString&);
private:
@@ -57,3 +59,4 @@ private:
QPopupMenu *hlmenu;
-
+ uint nextUnnamed;
+ uint viewCount;
};