author | paule <paule> | 2007-01-13 07:12:11 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-13 07:12:11 (UTC) |
commit | bccf96bb5b516d05df54dbcee8b8402ded815ed4 (patch) (unidiff) | |
tree | 9de5251a1a34321c9fcd41bc2b5b408244ff6135 /noncore/apps/tinykate/mainwindow/tinykate.cpp | |
parent | c0eb83f37ec3c49d0c6b322840605f2a95ea0b52 (diff) | |
download | opie-bccf96bb5b516d05df54dbcee8b8402ded815ed4.zip opie-bccf96bb5b516d05df54dbcee8b8402ded815ed4.tar.gz opie-bccf96bb5b516d05df54dbcee8b8402ded815ed4.tar.bz2 |
Add Edit menu with find, replace & go to line functions. Uses dialogs/code already provided by libkate.
Fixes bug #1231.
Diffstat (limited to 'noncore/apps/tinykate/mainwindow/tinykate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/mainwindow/tinykate.cpp | 27 |
1 files changed, 21 insertions, 6 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 | |||
@@ -89,6 +89,7 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
89 | mb->insertItem(tr("File"),popup); | 89 | mb->insertItem(tr("File"),popup); |
90 | 90 | ||
91 | //EDIT ACTIONS | 91 | //EDIT ACTIONS |
92 | popup = new QPopupMenu( this ); | ||
92 | bool useBigIcon = qApp->desktop()->size().width() > 330; | 93 | bool useBigIcon = qApp->desktop()->size().width() > 330; |
93 | 94 | ||
94 | // Action for cutting text | 95 | // Action for cutting text |
@@ -109,11 +110,18 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
109 | editPaste->setAutoRaise( true ); | 110 | editPaste->setAutoRaise( true ); |
110 | editPaste->setIconSet( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ) ); | 111 | editPaste->setIconSet( Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ) ); |
111 | 112 | ||
112 | // Action for finding / replacing text | 113 | // Action for finding text |
113 | editFindReplace = new QToolButton( 0 ); | 114 | editFind = new QAction( tr( "Find..." ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), |
114 | editFindReplace->setUsesBigPixmap( useBigIcon ); | 115 | QString::null, 0, this, 0 ); |
115 | editFindReplace->setAutoRaise( true ); | 116 | editFind->addTo(popup); |
116 | editFindReplace->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) ); | 117 | |
118 | // Action for replacing text | ||
119 | editReplace = new QAction( tr( "Replace..." ), QString::null, 0, this, 0 ); | ||
120 | editReplace->addTo(popup); | ||
121 | |||
122 | // Action for going to a specific line | ||
123 | editGotoLine = new QAction( tr( "Goto Line..." ), QString::null, 0, this, 0 ); | ||
124 | editGotoLine->addTo(popup); | ||
117 | 125 | ||
118 | // Action for undo | 126 | // Action for undo |
119 | editUndo = new QToolButton( 0 ); | 127 | editUndo = new QToolButton( 0 ); |
@@ -127,6 +135,8 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
127 | editRedo->setAutoRaise( true ); | 135 | editRedo->setAutoRaise( true ); |
128 | editRedo->setIconSet( Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ) ); | 136 | editRedo->setIconSet( Opie::Core::OResource::loadPixmap( "redo", Opie::Core::OResource::SmallIcon ) ); |
129 | 137 | ||
138 | mb->insertItem(tr("Edit"),popup); | ||
139 | |||
130 | //VIEW ACITONS | 140 | //VIEW ACITONS |
131 | popup = new QPopupMenu( this ); | 141 | popup = new QPopupMenu( this ); |
132 | 142 | ||
@@ -145,7 +155,6 @@ TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : | |||
145 | mb->insertItem( editCut ); | 155 | mb->insertItem( editCut ); |
146 | mb->insertItem( editCopy ); | 156 | mb->insertItem( editCopy ); |
147 | mb->insertItem( editPaste ); | 157 | mb->insertItem( editPaste ); |
148 | mb->insertItem( editFindReplace ); | ||
149 | mb->insertItem( editUndo ); | 158 | mb->insertItem( editUndo ); |
150 | mb->insertItem( editRedo ); | 159 | mb->insertItem( editRedo ); |
151 | 160 | ||
@@ -246,6 +255,9 @@ void TinyKate::slotCurrentChanged( QWidget * view) | |||
246 | disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); | 255 | disconnect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); |
247 | disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); | 256 | disconnect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); |
248 | disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); | 257 | disconnect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); |
258 | disconnect(editFind,SIGNAL(activated()),currentView,SLOT(find())); | ||
259 | disconnect(editReplace,SIGNAL(activated()),currentView,SLOT(replace())); | ||
260 | disconnect(editGotoLine,SIGNAL(activated()),currentView,SLOT(gotoLine())); | ||
249 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 261 | disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
250 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 262 | disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
251 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 263 | disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |
@@ -259,6 +271,9 @@ void TinyKate::slotCurrentChanged( QWidget * view) | |||
259 | connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); | 271 | connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); |
260 | connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); | 272 | connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); |
261 | connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); | 273 | connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); |
274 | connect(editFind,SIGNAL(activated()),currentView,SLOT(find())); | ||
275 | connect(editReplace,SIGNAL(activated()),currentView,SLOT(replace())); | ||
276 | connect(editGotoLine,SIGNAL(activated()),currentView,SLOT(gotoLine())); | ||
262 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); | 277 | connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); |
263 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); | 278 | connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); |
264 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); | 279 | connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); |