-rw-r--r-- | noncore/apps/tinykate/tinykate.cpp | 78 | ||||
-rw-r--r-- | noncore/apps/tinykate/tinykate.h | 12 |
2 files changed, 46 insertions, 44 deletions
diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index a25f81f..694efc6 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -9,5 +9,5 @@ /*************************************************************************** * * - * This program is free software; you can redistribute it and/or modify * + * 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. * @@ -18,6 +18,6 @@ #include <qaction.h> #include <qlayout.h> -#include <qpe/qpetoolbar.h> -#include <qpe/qpemenubar.h> +#include <qtoolbutton.h> +#include <qmenubar.h> #include <qpe/resource.h> #include <qpe/global.h> @@ -42,10 +42,6 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : KGlobal::setAppName("TinyKATE"); - setToolBarsMovable(FALSE); - - QPEToolBar *bar = new QPEToolBar( this ); - bar->setHorizontalStretchable( TRUE ); - QPEMenuBar *mb = new QPEMenuBar( bar ); - mb->setMargin( 0 ); + QMenuBar *mb = new QMenuBar( this ); + mb->setMargin( 0 ); tabwidget=new OTabWidget(this); @@ -88,27 +84,32 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : // Action for cutting text - editCut = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, 0, this, 0 ); - editCut->addTo( bar ); + editCut = new QToolButton( 0 ); + editCut->setAutoRaise( true ); + editCut->setIconSet( Resource::loadPixmap( "cut" ) ); // Action for Copying text - editCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, 0, this, 0 ); - editCopy->addTo( bar ); + editCopy = new QToolButton( 0 ); + editCopy->setAutoRaise( true ); + editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); // Action for pasting text - editPaste = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); - editPaste->addTo( bar ); - + editPaste = new QToolButton( 0 ); + editPaste->setAutoRaise( true ); + editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); // Action for finding / replacing text - editFindReplace = new QAction( tr( "Find/Replace" ), Resource::loadPixmap("find"), QString::null, 0, this, 0 ); - editFindReplace->addTo( bar ); + editFindReplace = new QToolButton( 0 ); + editFindReplace->setAutoRaise( true ); + editFindReplace->setIconSet( Resource::loadPixmap("find") ); - // Action for undo - editUndo = new QAction( tr( "Undo" ),Resource::loadPixmap( "undo" ) , QString::null, 0, this, 0 ); - editUndo->addTo( bar ); + // Action for undo + editUndo = new QToolButton( 0 ); + editUndo->setAutoRaise( true ); + editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); // Action for redo - editRedo = new QAction( tr( "Redo" ),Resource::loadPixmap( "redo" ) , QString::null, 0, this, 0 ); - editRedo->addTo( bar ); + editRedo = new QToolButton( 0 ); + editRedo->setAutoRaise( true ); + editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); //VIEW ACITONS @@ -121,10 +122,17 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : viewDecFontSizes->addTo( popup ); - mb->insertItem(tr("View"),popup); + mb->insertItem(tr("View"),popup); + popup = new QPopupMenu( this ); + mb->insertItem(tr("Utils"),popup); - popup = new QPopupMenu( this ); - mb->insertItem(tr("Utils"),popup); + mb->insertItem( editCut ); + mb->insertItem( editCopy ); + mb->insertItem( editPaste ); + mb->insertItem( editFindReplace ); + mb->insertItem( editUndo ); + mb->insertItem( editRedo ); + //Highlight management @@ -187,6 +195,6 @@ void TinyKate::slotCurrentChanged( QWidget * view) disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); - disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); - disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); + disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); + disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); @@ -195,11 +203,11 @@ void TinyKate::slotCurrentChanged( QWidget * view) currentView=(KTextEditor::View*)view; - connect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); - connect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); - connect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); - connect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); - connect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); - connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); - connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); + connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); + connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); + connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); + connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); + connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); + connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); + connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h index bb32f98..cdd8f43 100644 --- a/noncore/apps/tinykate/tinykate.h +++ b/noncore/apps/tinykate/tinykate.h @@ -24,4 +24,5 @@ #include <ktexteditor.h> +class QToolButton; class QAction; class QPopupMenu; @@ -50,13 +51,6 @@ private: KTextEditor::View *currentView; - QAction *editCopy; - QAction *editCut; - QAction *editPaste; - QAction *editUndo; - QAction *editRedo; - QAction *editFindReplace; - QAction *viewIncFontSizes; - QAction *viewDecFontSizes; - QAction *utilSettings; + QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; + QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; QPopupMenu *hlmenu; |