summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/tinykate.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/tinykate/tinykate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/tinykate.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp
index 32c1eab..3c9a637 100644
--- a/noncore/apps/tinykate/tinykate.cpp
+++ b/noncore/apps/tinykate/tinykate.cpp
@@ -6,48 +6,49 @@
copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free softwaSre; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation. *
* ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
* *
***************************************************************************/
#include <qaction.h>
#include <qtoolbutton.h>
#include <qmenubar.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <opie2/ofiledialog.h>
#include "tinykate.h"
#include <katedocument.h>
#include <kglobal.h>
+using namespace Opie::Ui;
TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
QMainWindow( parent, name, f )
{
shutDown=false;
nextUnnamed=0;
currentView=0;
viewCount=0;
setCaption(tr("TinyKATE"));
KGlobal::setAppName("TinyKATE");
QMenuBar *mb = new QMenuBar( this );
mb->setMargin( 0 );
tabwidget=new OTabWidget(this);
setCentralWidget(tabwidget);
connect(tabwidget,SIGNAL(currentChanged(QWidget*)),this,SLOT(slotCurrentChanged(QWidget*)));
//FILE ACTIONS
QPopupMenu *popup = new QPopupMenu( this );
// Action for creating a new document
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
a->addTo( popup );
connect(a, SIGNAL(activated()), this, SLOT(slotNew()));
@@ -145,49 +146,49 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) :
utilSettings->addTo( popup);
if( qApp->argc() > 1) open(qApp->argv()[1]);
else slotNew();
}
TinyKate::~TinyKate( )
{
qWarning("TinyKate destructor\n");
shutDown=true;
while (currentView!=0) {
slotClose();
}
if( KGlobal::config() != 0 ) {
qWarning("deleting KateConfig object..\n");
delete KGlobal::config();
}
}
void TinyKate::slotOpen( )
{
- QString filename = Opie::OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
+ 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;
QFileInfo fi(filename);
QString filenamed = fi.fileName();
tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed );
qDebug(filename);
kd->setDocName( filenamed);
kd->open( filename );
viewCount++;
}
void TinyKate::setDocument(const QString& fileref)
{
open( fileref );
}
@@ -240,39 +241,39 @@ void TinyKate::slotClose( )
delete dv->document();
viewCount--;
if ((!viewCount) && (!shutDown)) slotNew();
}
void TinyKate::slotSave() {
// feel free to make this how you want
if (currentView==0) return;
// KateView *kv = (KateView*) currentView;
KateDocument *kd = (KateDocument*) currentView->document();
// qDebug("saving file "+kd->docName());
if( kd->docName().isEmpty())
slotSaveAs();
else
kd->saveFile();
// kv->save();
// kd->saveFile();
}
void TinyKate::slotSaveAs() {
if (currentView==0) return;
KateDocument *kd = (KateDocument*) currentView->document();
- QString filename= Opie::OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL,
- QString::null);
+ QString filename= OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL,
+ QString::null);
if (!filename.isEmpty()) {
qDebug("saving file "+filename);
QFileInfo fi(filename);
QString filenamed = fi.fileName();
kd->setDocFile( filename);
kd->setDocName( filenamed);
kd->saveFile();
// KTextEditor::View *dv = currentView;
// tabwidget->changeTab( dv, filenamed);
// need to change tab label here
}
}