[PATCH] TinyKATE: add find, replace & go to line functions
Paul Eggleton <[email protected]> Fri, 5 Jan 2007 22:27:09 +1300
| Newsgroups | gmane.comp.handhelds.opie.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi there, The attached patch adds find, replace & go to line functions to TinyKATE. In fact the code was already there, I just added an Edit menu with actions to access it and then fixed the crashes upon closing the dialogs. This fixes bug #1231 (http://opie-bugs.oszine.de/view.php?id=1231). Cheers, Paul _______________________________________________ http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex Opie-devel mailing list [email protected] https://handhelds.org/mailman/listinfo/opie-devel
tinykate_find.patch
(text/x-diff, 5.9 KB)
Index: noncore/apps/tinykate/libkate/view/kateview.cpp
===================================================================
RCS file: /cvs/opie/noncore/apps/tinykate/libkate/view/kateview.cpp,v
retrieving revision 1.8
diff -u -d -b -B -r1.8 kateview.cpp
--- noncore/apps/tinykate/libkate/view/kateview.cpp 1 Mar 2004 20:00:34 -0000 1.8
+++ noncore/apps/tinykate/libkate/view/kateview.cpp 5 Jan 2007 09:20:41 -0000
@@ -1893,6 +1893,7 @@
initSearch(s, searchFlags);
findAgain(s);
}
+ qApp->processEvents();
delete searchDialog;
}
@@ -1932,6 +1933,7 @@
initSearch(s, searchFlags);
replaceAgain();
}
+ qApp->processEvents();
delete searchDialog;
}
@@ -1952,6 +1954,7 @@
myViewInternal->updateView(KateView::ufUpdateOnScroll);
myDoc->updateViews(this); //uptade all other views except this one
}
+ qApp->processEvents();
delete dlg;
}
Index: noncore/apps/tinykate/libkate/view/kateviewdialog.cpp
===================================================================
RCS file: /cvs/opie/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp,v
retrieving revision 1.9
diff -u -d -b -B -r1.9 kateviewdialog.cpp
--- noncore/apps/tinykate/libkate/view/kateviewdialog.cpp 19 Mar 2004 03:38:01 -0000 1.9
+++ noncore/apps/tinykate/libkate/view/kateviewdialog.cpp 5 Jan 2007 09:20:42 -0000
@@ -230,6 +230,9 @@
topLayout->addWidget(e1);
topLayout->addSpacing(spacingHint()); // A little bit extra space
topLayout->addStretch(10);
+
+ page->setMinimumWidth(100);
+
e1->setFocus();
}
Index: noncore/apps/tinykate/mainwindow/tinykate.cpp
===================================================================
RCS file: /cvs/opie/noncore/apps/tinykate/mainwindow/tinykate.cpp,v
retrieving revision 1.5
diff -u -d -b -B -r1.5 tinykate.cpp
--- noncore/apps/tinykate/mainwindow/tinykate.cpp 4 Aug 2005 07:14:03 -0000 1.5
+++ noncore/apps/tinykate/mainwindow/tinykate.cpp 5 Jan 2007 09:20:43 -0000
@@ -89,6 +89,7 @@
mb->insertItem(tr("File"),popup);
//EDIT ACTIONS
+ popup = new QPopupMenu( this );
bool useBigIcon = qApp->desktop()->size().width() > 330;
// Action for cutting text
@@ -109,11 +110,18 @@
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 );
@@ -127,6 +135,8 @@
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 );
@@ -145,7 +155,6 @@
mb->insertItem( editCut );
mb->insertItem( editCopy );
mb->insertItem( editPaste );
- mb->insertItem( editFindReplace );
mb->insertItem( editUndo );
mb->insertItem( editRedo );
@@ -246,6 +255,9 @@
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)));
@@ -259,6 +271,9 @@
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)));
Index: noncore/apps/tinykate/mainwindow/tinykate.h
===================================================================
RCS file: /cvs/opie/noncore/apps/tinykate/mainwindow/tinykate.h,v
retrieving revision 1.3
diff -u -d -b -B -r1.3 tinykate.h
--- noncore/apps/tinykate/mainwindow/tinykate.h 24 Jun 2004 19:52:38 -0000 1.3
+++ noncore/apps/tinykate/mainwindow/tinykate.h 5 Jan 2007 09:20:43 -0000
@@ -54,8 +54,8 @@
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;