summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/tinykate.cpp
authorjowenn <jowenn>2002-11-22 21:18:23 (UTC)
committer jowenn <jowenn>2002-11-22 21:18:23 (UTC)
commit0f9ce3f60b6fbd350f79485ee8fc5fe37be692e1 (patch) (side-by-side diff)
treea55c913156515ca5a5df95f5a838ecf4a80bae87 /noncore/apps/tinykate/tinykate.cpp
parent575f126fe474ba1d1603de73088c342c2a3eaa8f (diff)
downloadopie-0f9ce3f60b6fbd350f79485ee8fc5fe37be692e1.zip
opie-0f9ce3f60b6fbd350f79485ee8fc5fe37be692e1.tar.gz
opie-0f9ce3f60b6fbd350f79485ee8fc5fe37be692e1.tar.bz2
Show icons
Diffstat (limited to 'noncore/apps/tinykate/tinykate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/tinykate.cpp24
1 files changed, 19 insertions, 5 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
@@ -18,12 +18,13 @@
#include <qaction.h>
#include <qlayout.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include <qpe/global.h>
+#include <qpe/qpeapplication.h>
#include <opie/ofiledialog.h>
#include "tinykate.h"
#include "pics/file-new.xpm"
#include "pics/file-open.xpm"
@@ -33,14 +34,16 @@
#include <katedocument.h>
#include <katehighlight.h>
TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
QMainWindow( parent, name, f )
-{
+{
+ nextUnnamed=0;
currentView=0;
+ viewCount=0;
setCaption(tr("TinyKATE"));
setToolBarsMovable(FALSE);
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
@@ -134,25 +137,34 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
popup->insertItem(tr("Highlighting"),hlmenu);
utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 );
utilSettings->addTo( popup);
+ if( qApp->argc() > 1) open(qApp->argv()[1]);
+ else slotNew();
+
}
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)
{
if (currentView) {
disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy()));
@@ -181,19 +193,21 @@ void TinyKate::slotCurrentChanged( QWidget * view)
}
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( )
{
if (currentView==0) return;
KTextEditor::View *dv=currentView;
currentView=0;
tabwidget->removePage(dv);
delete dv->document();
+ viewCount--;
+ if (!viewCount) slotNew();
}