-rw-r--r-- | noncore/apps/tinykate/mainwindow/tinykate.cpp | 27 | ||||
-rw-r--r-- | noncore/apps/tinykate/mainwindow/tinykate.h | 4 |
2 files changed, 23 insertions, 8 deletions
diff --git a/noncore/apps/tinykate/mainwindow/tinykate.cpp b/noncore/apps/tinykate/mainwindow/tinykate.cpp index e808a2e..b1b88e9 100644 --- a/noncore/apps/tinykate/mainwindow/tinykate.cpp +++ b/noncore/apps/tinykate/mainwindow/tinykate.cpp @@ -80,81 +80,90 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); // Action for closing the currently active document a = new QAction( tr( "Close" ), Opie::Core::OResource::loadPixmap( "quit_icon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotClose())); mb->insertItem(tr("File"),popup); //EDIT ACTIONS + popup = new QPopupMenu( this ); bool useBigIcon = qApp->desktop()->size().width() > 330; // Action for cutting text editCut = new QToolButton( 0 ); editCut->setUsesBigPixmap( useBigIcon ); editCut->setAutoRaise( true ); editCut->setIconSet( Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ) ); // Action for Copying text editCopy = new QToolButton( 0 ); editCopy->setUsesBigPixmap( useBigIcon ); editCopy->setAutoRaise( true ); editCopy->setIconSet( Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ) ); // Action for pasting text editPaste = new QToolButton( 0 ); editPaste->setUsesBigPixmap( useBigIcon ); editPaste->setAutoRaise( true ); editPaste->setIconSet( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ) ); - // Action for finding / replacing text - editFindReplace = new QToolButton( 0 ); - editFindReplace->setUsesBigPixmap( useBigIcon ); - editFindReplace->setAutoRaise( true ); - editFindReplace->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) ); + // Action for finding text + editFind = new QAction( tr( "Find..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), + QString::null, 0, this, 0 ); + editFind->addTo(popup); + + // Action for replacing text + editReplace = new QAction( tr( "Replace..." ), QString::null, 0, this, 0 ); + editReplace->addTo(popup); + + // Action for going to a specific line + editGotoLine = new QAction( tr( "Goto Line..." ), QString::null, 0, this, 0 ); + editGotoLine->addTo(popup); // Action for undo editUndo = new QToolButton( 0 ); editUndo->setUsesBigPixmap( useBigIcon ); editUndo->setAutoRaise( true ); editUndo->setIconSet( Opie::Core::OResource::loadPixmap( "undo", Opie::Core::OResource::SmallIcon ) ); // Action for redo editRedo = new QToolButton( 0 ); editRedo->setUsesBigPixmap( useBigIcon ); editRedo->setAutoRaise( true ); editRedo->setIconSet( Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ) ); + mb->insertItem(tr("Edit"),popup); + //VIEW ACITONS popup = new QPopupMenu( this ); viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); viewIncFontSizes->addTo( popup ); viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); viewDecFontSizes->addTo( popup ); mb->insertItem(tr("View"),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 hlmenu=new QPopupMenu(this); HlManager *hlm=HlManager::self(); for (int i=0;i<hlm->highlights();i++) { hlmenu->insertItem(hlm->hlName(i),i); } popup->insertItem(tr("Highlighting"),hlmenu); @@ -237,37 +246,43 @@ void TinyKate::setDocument(const QString& fileref) } void TinyKate::slotCurrentChanged( QWidget * view) { if (currentView) { disconnect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); disconnect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); + disconnect(editFind,SIGNAL(activated()),currentView,SLOT(find())); + disconnect(editReplace,SIGNAL(activated()),currentView,SLOT(replace())); + disconnect(editGotoLine,SIGNAL(activated()),currentView,SLOT(gotoLine())); 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())); } currentView=(KTextEditor::View*)view; 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(editFind,SIGNAL(activated()),currentView,SLOT(find())); + connect(editReplace,SIGNAL(activated()),currentView,SLOT(replace())); + connect(editGotoLine,SIGNAL(activated()),currentView,SLOT(gotoLine())); 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())); } void TinyKate::slotNew( ) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), diff --git a/noncore/apps/tinykate/mainwindow/tinykate.h b/noncore/apps/tinykate/mainwindow/tinykate.h index 8eb344d..6e95d87 100644 --- a/noncore/apps/tinykate/mainwindow/tinykate.h +++ b/noncore/apps/tinykate/mainwindow/tinykate.h @@ -45,22 +45,22 @@ protected slots: void slotClose(); void slotCurrentChanged(QWidget *); void slotSave(); void slotSaveAs(); protected: void open(const QString&); private: QString currentFileName; Opie::Ui::OTabWidget *tabwidget; KTextEditor::View *currentView; bool shutDown; - QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; - QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; + QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo; + QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings, *editFind, *editReplace, *editGotoLine; QPopupMenu *hlmenu; uint nextUnnamed; uint viewCount; }; #endif // __TINYKATE_H__ |