summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------admin0
-rw-r--r--kjots/CMakeLists.txt2
-rw-r--r--kjots/KJotsMain.cpp29
-rw-r--r--kjots/KJotsMain.h7
-rw-r--r--kjots/kjotsedit.cpp483
-rw-r--r--kjots/kjotsedit.h59
-rw-r--r--kjots/kjotsentry.cpp10
-rw-r--r--superkaramba/karamba.kdevses29
-rw-r--r--superkaramba/karamba.tdevelop257
-rw-r--r--tdefilereplace/tdefilereplace.tdevelop190
10 files changed, 546 insertions, 520 deletions
diff --git a/admin b/admin
-Subproject 85116532467b2bb4c73caf54c106c91a22dbe37
+Subproject 12bb2cad8e2982bd842d168158e391d6c12fb6a
diff --git a/kjots/CMakeLists.txt b/kjots/CMakeLists.txt
index addcfed..c2ae2eb 100644
--- a/kjots/CMakeLists.txt
+++ b/kjots/CMakeLists.txt
@@ -31,7 +31,7 @@ tde_add_executable( kjots AUTOMOC
kjotsedit.cpp kjotsbookmarks.cpp
confpagefont.ui confpagemisc.ui
KJotsSettings.kcfgc
- LINK tdeprint-shared
+ LINK tdeprint-shared tdeutils-shared
DESTINATION ${BIN_INSTALL_DIR}
)
diff --git a/kjots/KJotsMain.cpp b/kjots/KJotsMain.cpp
index 5510f23..1e58f8f 100644
--- a/kjots/KJotsMain.cpp
+++ b/kjots/KJotsMain.cpp
@@ -93,7 +93,6 @@ KJotsMain::KJotsMain(const char* name)
me_text->setFocusPolicy(TQWidget::StrongFocus);
me_text->setEnabled(false);
textStack->addWidget(me_text);
- connect(me_text, TQ_SIGNAL(findSuccessful()), this, TQ_SLOT(slotFindSuccessful()));
roTextView = new KTextBrowser(textStack, "roTextView", true);
textStack->addWidget(roTextView);
@@ -156,10 +155,10 @@ KJotsMain::KJotsMain(const char* name)
actions[ACTION_PASTE2TITLE]->setEnabled(false);
actions[ACTION_PASTE] = KStdAction::pasteText(me_text, TQ_SLOT(paste()), actionCollection());
- actions[ACTION_FIND] = KStdAction::find( this, TQ_SLOT( slotSearch() ), actionCollection() );
- actions[ACTION_FIND_NEXT] = KStdAction::findNext( this, TQ_SLOT( slotRepeatSearch() ), actionCollection() );
- actions[ACTION_FIND_NEXT]->setEnabled(false);
- actions[ACTION_REPLACE] = KStdAction::replace( this, TQ_SLOT( slotReplace() ), actionCollection() );
+ actions[ACTION_FIND] = KStdAction::find(me_text, TQ_SLOT(find()), actionCollection());
+ actions[ACTION_FIND_NEXT] = KStdAction::findNext(me_text, TQ_SLOT(findNext()), actionCollection());
+ actions[ACTION_FIND_PREV] = KStdAction::findPrev(me_text, TQ_SLOT(findPrev()), actionCollection());
+ actions[ACTION_REPLACE] = KStdAction::replace(me_text, TQ_SLOT(replace()), actionCollection());
actions[ACTION_RENAME] = new TDEAction(i18n("Rename..."), TQString(), CTRL + Key_M, this,
TQ_SLOT(slotRenameEntry()), actionCollection(), "rename_entry");
@@ -404,21 +403,6 @@ void KJotsMain::configure()
dialog->show();
}
-void KJotsMain::slotSearch()
-{
- me_text->search();
-}
-
-void KJotsMain::slotRepeatSearch()
-{
- me_text->repeatSearch();
-}
-
-void KJotsMain::slotReplace()
-{
- me_text->replace();
-}
-
void KJotsMain::updateConfiguration()
{
static int encoding = -1;
@@ -649,11 +633,6 @@ void KJotsMain::updateMenu()
}
}
-void KJotsMain::slotFindSuccessful()
-{
- actions[ACTION_FIND_NEXT]->setEnabled(true);
-}
-
void KJotsMain::showListviewContextMenu(TDEListView*, TQListViewItem* i, const TQPoint& p)
{
if ( invalidMoveFlag ) return; //Prevent race condition
diff --git a/kjots/KJotsMain.h b/kjots/KJotsMain.h
index b9dfb3c..ea38f08 100644
--- a/kjots/KJotsMain.h
+++ b/kjots/KJotsMain.h
@@ -77,7 +77,8 @@ class KJotsEdit;
#define ACTION_REPLACE 21
#define ACTION_RENAME 22
#define ACTION_INSERT_DATE 23
-#define ACTION_MAX 24
+#define ACTION_FIND_PREV 24
+#define ACTION_MAX 25
class KJotsMain : public TDEMainWindow
{
@@ -106,11 +107,7 @@ class KJotsMain : public TDEMainWindow
void copySelection();
void insertDate();
void slotPrint();
- void slotSearch();
- void slotRepeatSearch();
- void slotReplace();
void slotQuit();
- void slotFindSuccessful();
void jumpToEntry(TQListViewItem* entry, bool=false);
diff --git a/kjots/kjotsedit.cpp b/kjots/kjotsedit.cpp
index 2b78698..b2ffe89 100644
--- a/kjots/kjotsedit.cpp
+++ b/kjots/kjotsedit.cpp
@@ -25,8 +25,13 @@
#include <tqcursor.h>
#include <tdepopupmenu.h>
-#include <keditcl.h>
+#include <kfind.h>
+#include <kfinddialog.h>
+#include <kreplace.h>
+#include <kreplacedialog.h>
+#include <kstringhandler.h>
#include <tdelocale.h>
+#include <tdemessagebox.h>
#include <kopenwith.h>
#include <kprinter.h>
@@ -37,8 +42,12 @@
// MYMULTIEDIT
//----------------------------------------------------------------------
KJotsEdit::KJotsEdit (TQWidget* parent, const char* name)
- : KEdit(parent, name),
- m_entry(0)
+ : KTextEdit(parent, name)
+ , m_entry(nullptr)
+ , m_find(nullptr)
+ , m_findDialog(nullptr)
+ , m_replace(nullptr)
+ , m_replaceDialog(nullptr)
{
// no rich text until printing and other such issues are worked out
setTextFormat(TQt::PlainText);
@@ -50,7 +59,8 @@ KJotsEdit::KJotsEdit (TQWidget* parent, const char* name)
KJotsEdit::~KJotsEdit()
{
-
+ delete m_find;
+ delete m_replace;
}
void KJotsEdit::mousePressEvent( TQMouseEvent *e )
@@ -67,7 +77,7 @@ void KJotsEdit::mousePressEvent( TQMouseEvent *e )
}
}
- KEdit::mousePressEvent(e);
+ KTextEdit::mousePressEvent(e);
}
void KJotsEdit::openUrl()
@@ -121,6 +131,441 @@ void KJotsEdit::print(TQString title)
}
}
+void KJotsEdit::slotFindHighlight(const TQString& text, int matchIndex, int matchLength)
+{
+ // tqDebug("KJotsEdit::slotFindHighlight");
+
+ Q_UNUSED(text);
+
+ const bool inSelection = m_find->options() & KFindDialog::SelectedText;
+
+ // Ensure we are offsetting the selection for the first line of the selection
+ // so we don't highlight the wrong text.
+ if (inSelection && (m_findCursor.paragraph == m_selectionStart.paragraph))
+ {
+ setSelection(m_findCursor.paragraph, m_selectionStart.paragraphIndex + matchIndex, m_findCursor.paragraph,
+ m_selectionStart.paragraphIndex + matchIndex + matchLength);
+ }
+ else
+ {
+ setSelection(m_findCursor.paragraph, matchIndex, m_findCursor.paragraph, matchIndex + matchLength);
+ }
+}
+
+void KJotsEdit::slotReplaceHighlight(const TQString& text, int matchIndex, int matchLength)
+{
+ // tqDebug("KJotsEdit::slotReplaceHighlight");
+
+ Q_UNUSED(text);
+
+ setSelection(m_replaceCursor.paragraph, matchIndex, m_replaceCursor.paragraph, matchIndex + matchLength);
+}
+
+void KJotsEdit::replace()
+{
+ // tqDebug("KJotsEdit::replace");
+
+ if (length() == 0)
+ {
+ return;
+ }
+
+ if (m_replaceDialog)
+ {
+ m_replaceDialog->setActiveWindow();
+ }
+ else
+ {
+ m_replaceDialog = new KReplaceDialog(this, "m_replaceDialog", KReplaceDialog::PromptOnReplace);
+ connect(m_replaceDialog, TQ_SIGNAL(okClicked()), this, TQ_SLOT(slotDoReplace()));
+ }
+
+ if (hasSelectedText())
+ {
+ m_replaceDialog->setHasSelection(true);
+ m_replaceDialog->setOptions(m_replaceDialog->options() | KReplaceDialog::SelectedText);
+ }
+ else
+ {
+ m_replaceDialog->setHasSelection(false);
+ m_replaceDialog->setOptions(m_replaceDialog->options() & ~KReplaceDialog::SelectedText);
+ }
+
+ m_replaceDialog->show();
+}
+
+void KJotsEdit::slotDoReplace()
+{
+ // tqDebug("KJotsEdit::slotDoReplace");
+
+ /* Performing a new replacement, so we need to remove the previous
+ * KReplace, set up a new one and the 'replaceNext' functionality. */
+
+ delete m_replace;
+ m_replace = nullptr;
+
+ if (!m_replaceDialog)
+ {
+ // tqDebug("KJotsEdit::slotDoReplace: no replaceDialog");
+ return;
+ }
+
+ m_replace = new KReplace(m_replaceDialog->pattern(), m_replaceDialog->replacement(), m_replaceDialog->options());
+
+ if ((m_replace->options() & KReplaceDialog::SelectedText))
+ {
+ const bool backwards = m_replace->options() & KFindDialog::FindBackwards;
+
+ getSelection(&m_selectionStart.paragraph, &m_selectionStart.paragraphIndex, &m_selectionEnd.paragraph,
+ &m_selectionEnd.paragraphIndex);
+ m_replaceCursor.paragraph = backwards ? m_selectionEnd.paragraph : m_selectionStart.paragraph;
+ m_replaceCursor.paragraphIndex = backwards ? m_selectionEnd.paragraphIndex : m_selectionStart.paragraphIndex;
+ }
+ else
+ {
+ setupCursor(&m_replaceCursor, m_replace);
+ }
+
+ connect(m_replace, TQ_SIGNAL(highlight(const TQString&, int, int)), this,
+ TQ_SLOT(slotReplaceHighlight(const TQString&, int, int)));
+ connect(m_replace, TQ_SIGNAL(findNext()), this, TQ_SLOT(slotReplaceNext()));
+ connect(m_replace, TQ_SIGNAL(replace(const TQString&, int, int, int)), this,
+ TQ_SLOT(slotReplace(const TQString&, int, int, int)));
+
+ m_replaceDialog->close();
+ slotReplaceNext();
+}
+
+void KJotsEdit::slotReplace(const TQString& replaceText, int replacementIndex, int replacementLength, int matchedLength)
+{
+ // tqDebug("KJotsEdit::slotReplace");
+
+ // Ensure the selection only matches the replacement.
+ // Prevents an issue where all the text is selected before replacing (since we remove the selection below).
+ setSelection(m_replaceCursor.paragraph, replacementIndex, m_replaceCursor.paragraph,
+ replacementIndex + matchedLength);
+
+ const auto replacement = replaceText.mid(replacementIndex, replacementLength);
+ removeSelectedText();
+ insertAt(replacement, m_replaceCursor.paragraph, replacementIndex);
+ setModified(true);
+}
+
+void KJotsEdit::slotReplaceNext()
+{
+ // tqDebug("KJotsEdit::slotReplaceNext");
+
+ if (!m_replace)
+ {
+ return;
+ }
+
+ const bool backwards = (m_replace->options() & KReplaceDialog::FindBackwards);
+ const bool useSelection = (m_replace->options() & KReplaceDialog::SelectedText);
+
+ if (m_replace->needData())
+ {
+ if (useSelection && backwards)
+ {
+ m_replace->setData(text(m_selectionEnd.paragraph), m_selectionEnd.paragraphIndex);
+ }
+ else if (useSelection)
+ {
+ m_replace->setData(text(m_selectionStart.paragraph), m_selectionStart.paragraphIndex);
+ }
+ else
+ {
+ m_replace->setData(text(m_replaceCursor.paragraph), m_replaceCursor.paragraphIndex);
+ }
+ }
+
+ KReplace::Result res = KReplace::NoMatch;
+
+ do
+ {
+ res = m_replace->replace();
+ if (res == KReplace::Match)
+ {
+ return;
+ }
+
+ m_replaceCursor.paragraph += (backwards ? -1 : 1);
+ m_replaceCursor.paragraphIndex = (backwards ? paragraphLength(m_replaceCursor.paragraph) : 0);
+ m_replace->setData(text(m_replaceCursor.paragraph), m_replaceCursor.paragraphIndex);
+
+ if (useSelection && m_replaceCursor.paragraph > m_selectionEnd.paragraph)
+ {
+ break;
+ }
+
+ if (useSelection && backwards && m_replaceCursor.paragraph < m_selectionStart.paragraph)
+ {
+ break;
+ }
+ } while (backwards ? (m_replaceCursor.paragraph >= 0) : (m_replaceCursor.paragraph < paragraphs()));
+
+ Q_ASSERT(res != KReplace::Match);
+
+ if ((m_replace->options() & KReplaceDialog::FromCursor) && m_replace->shouldRestart(true))
+ {
+ // tqDebug("KJotsEdit::slotReplaceNext restarting");
+ m_replaceCursor.paragraph = backwards ? (paragraphs() - 1) : 0;
+ m_replaceCursor.paragraphIndex = backwards ? (paragraphLength(m_replaceCursor.paragraph)) : 0;
+ m_replace->setData(text(m_replaceCursor.paragraph), m_replaceCursor.paragraphIndex);
+ m_replace->resetCounts();
+ slotReplaceNext();
+ return;
+ }
+
+ m_replace->displayFinalDialog();
+ m_replace->disconnect(this, TQ_SLOT(slotReplaceHighlight(const TQString&, int, int)));
+ m_replace->deleteLater();
+ m_replace = nullptr;
+}
+
+void KJotsEdit::find()
+{
+ // tqDebug("KJotsEdit::find");
+
+ if (length() == 0)
+ {
+ return;
+ }
+
+ if (m_findDialog)
+ {
+ m_findDialog->setActiveWindow();
+ }
+ else
+ {
+ m_findDialog = new KFindDialog(this, "m_findDialog");
+ connect(m_findDialog, TQ_SIGNAL(okClicked()), this, TQ_SLOT(slotDoFind()));
+ }
+
+ if (hasSelectedText())
+ {
+ m_findDialog->setHasSelection(true);
+ m_findDialog->setOptions(m_findDialog->options() | KFindDialog::SelectedText);
+ }
+ else
+ {
+ m_findDialog->setHasSelection(false);
+ m_findDialog->setOptions(m_findDialog->options() & ~KFindDialog::SelectedText);
+ }
+
+
+ m_findDialog->show();
+}
+
+void KJotsEdit::findNext()
+{
+ // tqDebug("KJotsEdit::findNext");
+
+ if (!m_find)
+ {
+ find();
+ return;
+ }
+
+ const bool backwards = (m_find->options() & KFindDialog::FindBackwards);
+ const bool fromCursor = (m_find->options() & KFindDialog::FromCursor);
+ const bool inSelection = (m_find->options() & KFindDialog::SelectedText);
+
+ if (m_find->needData())
+ {
+ if (inSelection)
+ {
+ if (m_selectionStart.paragraph == m_selectionEnd.paragraph)
+ {
+ // Same line, ensure we only inlcude the selection.
+ auto selectionLength = m_selectionEnd.paragraphIndex - m_selectionStart.paragraphIndex;
+ auto data = text(m_findCursor.paragraph).mid(m_selectionStart.paragraphIndex, selectionLength);
+ m_find->setData(data);
+ }
+ else if (backwards)
+ {
+ m_findCursor.paragraph = m_selectionEnd.paragraph;
+ m_findCursor.paragraphIndex = -1;
+ m_find->setData(text(m_findCursor.paragraph).left(m_selectionEnd.paragraphIndex));
+ }
+ else
+ {
+ m_findCursor.paragraph = m_selectionStart.paragraph;
+ m_findCursor.paragraphIndex = 0;
+ auto offset = (paragraphLength(m_findCursor.paragraph)) - m_selectionStart.paragraphIndex+1;
+ m_find->setData(text(m_findCursor.paragraph).right(offset), m_findCursor.paragraphIndex);
+ }
+ }
+ else
+ {
+ m_find->setData(text(m_findCursor.paragraph), m_findCursor.paragraphIndex);
+ }
+ }
+
+ KFind::Result res = KFind::NoMatch;
+
+ do
+ {
+ res = m_find->find();
+ if (res == KFind::Match)
+ {
+ return;
+ }
+
+ m_findCursor.paragraph += (backwards ? -1 : 1);
+ m_findCursor.paragraphIndex = -1; // SOL or EOL depending on `backwards`.
+
+ if (m_findCursor.paragraph == m_selectionStart.paragraph)
+ {
+ auto offset = (paragraphLength(m_findCursor.paragraph)) - m_selectionStart.paragraphIndex+1;
+ m_find->setData(text(m_findCursor.paragraph).right(offset), m_findCursor.paragraphIndex);
+ }
+ else if (m_findCursor.paragraph == m_selectionEnd.paragraph)
+ {
+ m_find->setData(text(m_findCursor.paragraph).left(m_selectionEnd.paragraphIndex), m_findCursor.paragraphIndex);
+ }
+ else
+ {
+ m_findCursor.paragraphIndex = -1;
+ m_find->setData(text(m_findCursor.paragraph), m_findCursor.paragraphIndex);
+ }
+
+ if (inSelection && backwards && m_findCursor.paragraph < m_selectionStart.paragraph)
+ {
+ break;
+ }
+
+ if (inSelection && m_findCursor.paragraph > m_selectionEnd.paragraph)
+ {
+ break;
+ }
+ } while (backwards ? (m_findCursor.paragraph >= 0) : (m_findCursor.paragraph < paragraphs()));
+
+ Q_ASSERT(res != KFind::Match);
+
+ // If there were no matches, and we were checking from the start of the text,
+ // then we do not want to prompt to search again, since we already know there
+ // is nothing.
+
+ if (m_find->numMatches() == 0 && !fromCursor)
+ {
+ KMessageBox::sorry(this,
+ i18n("Search string '%1' was not found!").arg(KStringHandler::csqueeze(m_find->pattern())));
+ // Reset the cursor in case more text is added between calls to findNext()
+ m_findCursor = m_selectionStart;
+ m_find->setData(text(m_selectionStart.paragraph)
+ .mid(m_selectionStart.paragraphIndex,
+ m_selectionEnd.paragraphIndex - m_selectionStart.paragraphIndex));
+ return;
+ }
+
+ if (m_find->shouldRestart(/* forceAsking */ true, /* showNumMatches */ false))
+ {
+ if (inSelection)
+ {
+ if (m_selectionStart.paragraph == m_selectionEnd.paragraph)
+ {
+ m_findCursor.paragraph = m_selectionStart.paragraph;
+ m_findCursor.paragraphIndex = m_selectionStart.paragraphIndex;
+ auto selectionLength = m_selectionEnd.paragraphIndex - m_selectionStart.paragraphIndex;
+ auto data = text(m_findCursor.paragraph).mid(m_findCursor.paragraphIndex, selectionLength);
+ m_find->setData(data);
+ }
+ else if (backwards)
+ {
+ m_findCursor = m_selectionEnd;
+ m_find->setData(text(m_findCursor.paragraph).left(m_findCursor.paragraphIndex));
+ }
+ else
+ {
+ m_findCursor.paragraph = m_selectionStart.paragraph;
+ m_findCursor.paragraphIndex = -1;
+ auto offset = (paragraphLength(m_findCursor.paragraph)) - m_selectionStart.paragraphIndex+1;
+ m_find->setData(text(m_findCursor.paragraph).right(offset), m_findCursor.paragraphIndex);
+ }
+ }
+ else
+ {
+ m_findCursor.paragraph = backwards ? (paragraphs() - 1) : 0;
+ m_findCursor.paragraphIndex = backwards ? (paragraphLength(m_findCursor.paragraph)) : 0;
+ m_find->setData(text(m_findCursor.paragraph), m_findCursor.paragraphIndex);
+ }
+
+ m_find->resetCounts();
+ findNext();
+ }
+}
+
+void KJotsEdit::findPrev()
+{
+ if (!m_find)
+ {
+ find();
+ return;
+ }
+
+ m_find->setOptions(m_find->options() ^ KFindDialog::FindBackwards);
+ findNext();
+
+ // Check as pressing 'stop' will delete m_find.
+ if (m_find)
+ {
+ m_find->setOptions(m_find->options() ^ KFindDialog::FindBackwards);
+ }
+}
+
+void KJotsEdit::slotDoFind()
+{
+ // tqDebug("KJotsEdit::slotDoFind");
+
+ /* Performing a new search, ensure the previous search is invalidated. */
+
+ delete m_find;
+ m_find = nullptr;
+
+ if (!m_findDialog)
+ {
+ // tqDebug("KJotsEdit::slotDoFind: find dialog not set up");
+ return;
+ }
+
+ if (m_findDialog->pattern().isEmpty())
+ {
+ // tqDebug("KJotsEdit::slotDoFind: empty pattern.");
+ return;
+ }
+
+ // tqDebug("findDialog->pattern = %s", m_findDialog->pattern().local8Bit().data());
+
+ m_find = new KFind(m_findDialog->pattern(), m_findDialog->options(), this);
+
+ if (m_find->options() & KFindDialog::SelectedText)
+ {
+ const bool backwards = m_find->options() & KFindDialog::FindBackwards;
+
+ getSelection(&m_selectionStart.paragraph, &m_selectionStart.paragraphIndex, &m_selectionEnd.paragraph,
+ &m_selectionEnd.paragraphIndex);
+ m_findCursor.paragraph = backwards ? m_selectionEnd.paragraph : m_selectionStart.paragraph;
+ m_findCursor.paragraphIndex = backwards ? m_selectionEnd.paragraphIndex : m_selectionStart.paragraphIndex;
+ }
+ else
+ {
+ setupCursor(&m_findCursor, m_find);
+ // Reset selection so slotFindHighlight works correctly.
+ m_selectionStart = {0, 0};
+ m_selectionEnd = {0, 0};
+ }
+
+ connect(m_find, TQ_SIGNAL(highlight(const TQString&, int, int)), this,
+ TQ_SLOT(slotFindHighlight(const TQString&, int, int)));
+ connect(m_find, TQ_SIGNAL(findNext()), this, TQ_SLOT(findNext()));
+
+ m_findDialog->close();
+ m_find->closeFindNextDialog();
+
+ findNext();
+}
+
void KJotsEdit::setEntry (KJotsPage *entry)
{
//tell the old entry to take a hike
@@ -144,6 +589,34 @@ void KJotsEdit::setEntry (KJotsPage *entry)
}
m_entry = entry;
+
+ // Reset the find & replace dialog for the new entry.
+ delete m_find;
+ delete m_replace;
+ m_find = nullptr;
+ m_replace = nullptr;
+}
+
+void KJotsEdit::setupCursor(KJotsEdit::CursorPosition* cursor, const KFind* find)
+{
+ if (!cursor)
+ {
+ tqWarning("WARNING: Attempting to setup a NULL cursor: %s (%d)", __FILE__, __LINE__);
+ return;
+ }
+
+ cursor->paragraph = 0;
+ cursor->paragraphIndex = 0;
+
+ if (find->options() & KFindDialog::FromCursor)
+ {
+ getCursorPosition(&cursor->paragraph, &cursor->paragraphIndex);
+ }
+ else if (find->options() & KFindDialog::FindBackwards)
+ {
+ cursor->paragraph = paragraphs();
+ cursor->paragraphIndex = paragraphLength(cursor->paragraph);
+ }
}
#include "kjotsedit.moc"
diff --git a/kjots/kjotsedit.h b/kjots/kjotsedit.h
index 6506fab..75012f8 100644
--- a/kjots/kjotsedit.h
+++ b/kjots/kjotsedit.h
@@ -23,11 +23,16 @@
#ifndef __KJOTSEDIT_H
#define __KJOTSEDIT_H
-#include <keditcl.h>
+#include <ktextedit.h>
+
+class KFind;
+class KFindDialog;
+class KReplace;
+class KReplaceDialog;
class TDEPopupMenu;
class KJotsPage;
-class KJotsEdit : public KEdit
+class KJotsEdit : public KTextEdit
{
TQ_OBJECT
@@ -41,14 +46,62 @@ class KJotsEdit : public KEdit
signals:
void findSuccessful();
+ public slots:
+ // Create the initial KFindDialog.
+ void find();
+ // Repeat the previous search.
+ // Creates KFindDialog if needed.
+ void findNext();
+ // Repeat the previous search, but in the opposite direction.
+ // Creates KFindDialog if needed.
+ void findPrev();
+ // Creates a KReplaceDialog
+ void replace();
+
protected slots:
- void openUrl();
+ void openUrl();
+ void slotFindHighlight(const TQString&, int, int);
+ void slotReplaceHighlight(const TQString&, int, int);
+ void slotDoFind();
+ void slotDoReplace();
+ void slotReplace(const TQString&, int, int, int);
+ void slotReplaceNext();
protected:
virtual void mousePressEvent (TQMouseEvent *e);
TDEPopupMenu *web_menu;
KJotsPage *m_entry; //!< The entry we are editing. It needs to be kept informed.
+
+ private:
+
+ /*
+ * Keep track of the current cursor position for find/replace
+ * functionality, allowing us to increment easily.
+ */
+ struct CursorPosition
+ {
+ // Current paragraph.
+ int paragraph;
+ // Index from start of current paragraph.
+ int paragraphIndex;
+ };
+
+ KFind *m_find;
+ KFindDialog *m_findDialog;
+ KReplace *m_replace;
+ KReplaceDialog *m_replaceDialog;
+
+ // Maintaining two positions to allow replace while find still active.
+ CursorPosition m_findCursor{0, 0};
+ CursorPosition m_replaceCursor{0, 0};
+
+ // Start and end position of selection, used to restart search with initial selection.
+ CursorPosition m_selectionStart{0, 0};
+ CursorPosition m_selectionEnd{0, 0};
+
+ // Setup for m_findCursor/m_replaceCursor with m_find/m_replace
+ void setupCursor(CursorPosition*, const KFind*);
};
#endif // __KJOTSEDIT_H
diff --git a/kjots/kjotsentry.cpp b/kjots/kjotsentry.cpp
index 0a20072..61ea63d 100644
--- a/kjots/kjotsentry.cpp
+++ b/kjots/kjotsentry.cpp
@@ -882,10 +882,10 @@ void KJotsPage::initNewPage(void)
TQString KJotsPage::body()
{
//if we're being edited we want the current text, not whatever we saved before.
- if ( m_editor && m_editor->edited() )
+ if (m_editor && m_editor->isModified())
{
m_text = m_editor->text();
- m_editor->setEdited(false);
+ m_editor->setModified(false);
setDirty(true);
}
@@ -1079,7 +1079,7 @@ void KJotsPage::setEditor( KJotsEdit *editor )
{
m_editor->getCursorPosition(&m_paraPos, &m_indexPos);
- if ( m_editor->edited() )
+ if (m_editor->isModified())
{
m_text = m_editor->text();
setDirty(true);
@@ -1091,7 +1091,7 @@ void KJotsPage::setEditor( KJotsEdit *editor )
//and in with the new
if ( m_editor )
{
- m_editor->setEdited(false);
+ m_editor->setModified(false);
m_editor->setCursorPosition(m_paraPos, m_indexPos);
}
@@ -1105,7 +1105,7 @@ void KJotsPage::setEditor( KJotsEdit *editor )
*/
bool KJotsPage::isDirty()
{
- if ( m_editor && m_editor->edited() )
+ if (m_editor && m_editor->isModified())
{
setDirty(true);
}
diff --git a/superkaramba/karamba.kdevses b/superkaramba/karamba.kdevses
deleted file mode 100644
index 66ecb62..0000000
--- a/superkaramba/karamba.kdevses
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version = '1.0' encoding = 'UTF-8'?>
-<!DOCTYPE KDevPrjSession>
-<KDevPrjSession>
- <DocsAndViews NumberOfDocuments="1" >
- <Doc0 NumberOfViews="1" URL="file:///home/damu/files/code/linux/kdereview/superkaramba/src/dcopinterface.h" >
- <View0 line="0" Type="Source" />
- </Doc0>
- </DocsAndViews>
- <pluginList>
- <kdevdebugger>
- <breakpointList>
- <breakpoint0 location="/usr/src/superkaramba.cvs/src/meter_python.cpp:27" type="1" condition="" enabled="1" />
- <breakpoint1 location="/usr/src/superkaramba.cvs/src/meter_python.cpp:182" type="1" condition="" enabled="1" />
- <breakpoint2 location="/usr/src/superkaramba.cvs/src/themelistwindow.cpp:141" type="1" condition="" enabled="1" />
- <breakpoint3 location="/usr/src/superkaramba.cvs/src/karambainterface.cpp:95" type="1" condition="" enabled="1" />
- <breakpoint4 location="/usr/src/superkaramba.cvs/src/karamba.cpp:1" type="1" condition="" enabled="1" />
- </breakpointList>
- </kdevdebugger>
- <kdevbookmarks>
- <bookmarks/>
- </kdevbookmarks>
- <kdevvalgrind>
- <executable path="" params="/usr/src/superkaramba.cvs/examples/richtext/rtext.theme" />
- <valgrind path="/usr/bin/valgrind" params="--tool=memcheck --gen-suppressions=yes" />
- <calltree path="" params="" />
- <tdecachegrind path="" />
- </kdevvalgrind>
- </pluginList>
-</KDevPrjSession>
diff --git a/superkaramba/karamba.tdevelop b/superkaramba/karamba.tdevelop
deleted file mode 100644
index 430b61f..0000000
--- a/superkaramba/karamba.tdevelop
+++ /dev/null
@@ -1,257 +0,0 @@
-<?xml version = '1.0'?>
-<tdevelop>
- <general>
- <author>See README for the list of authors</author>
- <email></email>
- <projectmanagement>KDevKDEAutoProject</projectmanagement>
- <primarylanguage>C++</primarylanguage>
- <keywords>
- <keyword>C++</keyword>
- <keyword>Code</keyword>
- <keyword>Qt</keyword>
- <keyword>KDE</keyword>
- </keywords>
- <version>0.36</version>
- <description></description>
- <ignoreparts/>
- <projectdirectory>..</projectdirectory>
- <absoluteprojectpath>false</absoluteprojectpath>
- <secondaryLanguages/>
- <versioncontrol></versioncontrol>
- </general>
- <kdevautoproject>
- <general>
- <activetarget>src/superkaramba</activetarget>
- <useconfiguration>debug</useconfiguration>
- </general>
- <run>
- <mainprogram>superkaramba/src/superkaramba</mainprogram>
- <programargs></programargs>
- <terminal>false</terminal>
- <envvars/>
- <directoryradio>build</directoryradio>
- <customdirectory>/home/damu/.trinity/share/apps/superkaramba/themes/hdd/</customdirectory>
- <autocompile>true</autocompile>
- </run>
- <makeenvvars>
- <envvar value="1" name="WANT_AUTOCONF_2_5" />
- <envvar value="1" name="WANT_AUTOMAKE_1_6" />
- </makeenvvars>
- <envvars/>
- <make>
- <abortonerror>true</abortonerror>
- <numberofjobs>1</numberofjobs>
- <dontact>false</dontact>
- <makebin/>
- <envvars>
- <envvar value="1" name="WANT_AUTOCONF_2_5" />
- <envvar value="1" name="WANT_AUTOMAKE_1_6" />
- </envvars>
- <prio>0</prio>
- </make>
- <configurations>
- <optimized>
- <builddir>optimized</builddir>
- <ccompiler>kdevgccoptions</ccompiler>
- <cxxcompiler>kdevgppoptions</cxxcompiler>
- <f77compiler>kdevg77options</f77compiler>
- <cxxflags>-O2 -g0</cxxflags>
- <envvars/>
- <configargs/>
- <topsourcedir/>
- <cppflags/>
- <ldflags/>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
- <cflags/>
- <f77flags/>
- </optimized>
- <debug>
- <configargs>--enable-debug=full</configargs>
- <builddir>debug</builddir>
- <ccompiler>kdevgccoptions</ccompiler>
- <cxxcompiler>kdevgppoptions</cxxcompiler>
- <f77compiler>kdevg77options</f77compiler>
- <cxxflags>-O0 -g3</cxxflags>
- <topsourcedir/>
- <cppflags/>
- <ldflags/>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
- <cflags>-O0 -g3</cflags>
- <f77flags/>
- <envvars/>
- </debug>
- <default>
- <configargs>--prefix=/usr</configargs>
- <builddir/>
- <ccompiler>kdevgccoptions</ccompiler>
- <cxxcompiler>kdevgppoptions</cxxcompiler>
- <f77compiler>kdevpgf77options</f77compiler>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
- <cflags/>
- <cxxflags>-march=athlon-xp -mcpu=athlon-xp -mmmx -m3dnow -msse</cxxflags>
- <f77flags/>
- <topsourcedir>..</topsourcedir>
- <cppflags/>
- <ldflags/>
- <envvars/>
- </default>
- </configurations>
- </kdevautoproject>
- <kdevfileview>
- <groups>
- <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
- <group pattern="*.ui" name="User Interface" />
- <group pattern="*.png" name="Icons" />
- <group pattern="*.po;*.ts" name="Translations" />
- <group pattern="*" name="Others" />
- <hidenonprojectfiles>false</hidenonprojectfiles>
- <hidenonlocation>false</hidenonlocation>
- </groups>
- <tree>
- <hidenonprojectfiles>false</hidenonprojectfiles>
- <hidepatterns>*.o,*.lo,CVS</hidepatterns>
- <showvcsfields>false</showvcsfields>
- </tree>
- </kdevfileview>
- <kdevdoctreeview>
- <ignoretocs>
- <toc>gtk</toc>
- <toc>gnustep</toc>
- <toc>python</toc>
- <toc>php</toc>
- <toc>perl</toc>
- </ignoretocs>
- <projectdoc>
- <userdocDir>/home/hk/src/karamba/html/</userdocDir>
- <apidocDir>/home/hk/src/karamba/html/</apidocDir>
- </projectdoc>
- <ignoreqt_xml/>
- <ignoredoxygen/>
- <ignorekdocs/>
- <ignoredevhelp/>
- </kdevdoctreeview>
- <kdevdebugger>
- <general>
- <dbgshell>libtool</dbgshell>
- <programargs>/home/damu/.trinity/share/apps/superkaramba/themes/hdd/hdd.theme</programargs>
- <gdbpath></gdbpath>
- <breakonloadinglibs>false</breakonloadinglibs>
- <separatetty>false</separatetty>
- <floatingtoolbar>false</floatingtoolbar>
- <configGdbScript></configGdbScript>
- <runShellScript></runShellScript>
- <runGdbScript></runGdbScript>
- </general>
- <display>
- <staticmembers>false</staticmembers>
- <demanglenames>true</demanglenames>
- <outputradix>10</outputradix>
- </display>
- </kdevdebugger>
- <cppsupportpart>
- <codecompletion>
- <codehinting outputview="1" enablech="1" selectview="0" />
- </codecompletion>
- <classstore>
- <enablepcs>false</enablepcs>
- <enablepp>false</enablepp>
- <preparsing/>
- </classstore>
- <filetemplates>
- <choosefiles>false</choosefiles>
- <interfaceURL/>
- <implementationURL/>
- <interfacesuffix>.h</interfacesuffix>
- <implementationsuffix>.cpp</implementationsuffix>
- <lowercasefilenames>true</lowercasefilenames>
- </filetemplates>
- </cppsupportpart>
- <kdevclassview>
- <folderhierarchy>true</folderhierarchy>
- <depthoffolders>2</depthoffolders>
- </kdevclassview>
- <kdevcvs>
- <cvsoptions>-f</cvsoptions>
- <commitoptions/>
- <updateoptions>-dP</updateoptions>
- <addoptions/>
- <removeoptions>-f</removeoptions>
- <diffoptions>-u3 -p</diffoptions>
- <logoptions/>
- <rshoptions/>
- </kdevcvs>
- <kdevfilecreate>
- <filetypes/>
- <useglobaltypes/>
- </kdevfilecreate>
- <dist>
- <custom>false</custom>
- <bzip>false</bzip>
- <archname/>
- <appname/>
- <version/>
- <release/>
- <vendor/>
- <licence/>
- <summary/>
- <group/>
- <packager/>
- <description/>
- <changelog/>
- <devpackage>false</devpackage>
- <docspackage>false</docspackage>
- <appicon>false</appicon>
- <arch>0</arch>
- <genHTML>false</genHTML>
- <useRPM>false</useRPM>
- <ftpkde>false</ftpkde>
- <appskde>false</appskde>
- <url/>
- </dist>
- <kdevcppsupport>
- <codecompletion>
- <includeGlobalFunctions>true</includeGlobalFunctions>
- <includeTypes>true</includeTypes>
- <includeEnums>true</includeEnums>
- <includeTypedefs>false</includeTypedefs>
- <automaticCodeCompletion>true</automaticCodeCompletion>
- <automaticArgumentsHint>true</automaticArgumentsHint>
- <automaticHeaderCompletion>true</automaticHeaderCompletion>
- <codeCompletionDelay>250</codeCompletionDelay>
- <argumentsHintDelay>400</argumentsHintDelay>
- <headerCompletionDelay>250</headerCompletionDelay>
- </codecompletion>
- <references/>
- <creategettersetter>
- <prefixGet></prefixGet>
- <prefixSet>set</prefixSet>
- <prefixVariable>m_,_</prefixVariable>
- <parameterName>theValue</parameterName>
- <inlineGet>true</inlineGet>
- <inlineSet>true</inlineSet>
- </creategettersetter>
- <designerintegration>
- <tqtdesigner/>
- </designerintegration>
- </kdevcppsupport>
- <kdevcvsservice>
- <recursivewhenupdate>true</recursivewhenupdate>
- <prunedirswhenupdate>true</prunedirswhenupdate>
- <createdirswhenupdate>true</createdirswhenupdate>
- <recursivewhencommitremove>true</recursivewhencommitremove>
- <revertoptions>-C</revertoptions>
- </kdevcvsservice>
- <kdevdocumentation>
- <projectdoc>
- <docsystem/>
- <docurl/>
- <usermanualurl/>
- </projectdoc>
- </kdevdocumentation>
-</tdevelop>
diff --git a/tdefilereplace/tdefilereplace.tdevelop b/tdefilereplace/tdefilereplace.tdevelop
deleted file mode 100644
index d819ed5..0000000
--- a/tdefilereplace/tdefilereplace.tdevelop
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version = '1.0'?>
-<tdevelop>
- <general>
- <author/>
- <email/>
- <version>$VERSION$</version>
- <projectmanagement>KDevKDEAutoProject</projectmanagement>
- <primarylanguage>C++</primarylanguage>
- <keywords>
- <keyword>Qt</keyword>
- <keyword>KDE</keyword>
- </keywords>
- <projectdirectory>.</projectdirectory>
- <absoluteprojectpath>false</absoluteprojectpath>
- <description/>
- <ignoreparts/>
- <secondaryLanguages/>
- <versioncontrol>tdevcvsservice</versioncontrol>
- </general>
- <tdevfileview>
- <groups>
- <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
- <group pattern="*.ui" name="User Interface" />
- <group pattern="*.png" name="Icons" />
- <group pattern="*.po;*.ts" name="Translations" />
- <group pattern="*" name="Others" />
- <hidenonprojectfiles>false</hidenonprojectfiles>
- <hidenonlocation>false</hidenonlocation>
- </groups>
- <tree>
- <showvcsfields>false</showvcsfields>
- <hidenonprojectfiles>false</hidenonprojectfiles>
- <hidepatterns>*.o,*.lo,CVS</hidepatterns>
- </tree>
- </tdevfileview>
- <tdevdoctreeview>
- <ignoretocs>
- <toc>ada</toc>
- <toc>ada_bugs_gcc</toc>
- <toc>bash</toc>
- <toc>bash_bugs</toc>
- <toc>clanlib</toc>
- <toc>fortran_bugs_gcc</toc>
- <toc>gnome1</toc>
- <toc>gnustep</toc>
- <toc>gtk</toc>
- <toc>gtk_bugs</toc>
- <toc>haskell</toc>
- <toc>haskell_bugs_ghc</toc>
- <toc>java_bugs_gcc</toc>
- <toc>java_bugs_sun</toc>
- <toc>opengl</toc>
- <toc>pascal_bugs_fp</toc>
- <toc>php</toc>
- <toc>php_bugs</toc>
- <toc>perl</toc>
- <toc>perl_bugs</toc>
- <toc>python</toc>
- <toc>python_bugs</toc>
- <toc>ruby</toc>
- <toc>ruby_bugs</toc>
- <toc>sdl</toc>
- <toc>stl</toc>
- <toc>sw</toc>
- <toc>w3c-dom-level2-html</toc>
- <toc>w3c-svg</toc>
- <toc>w3c-uaag10</toc>
- <toc>wxwidgets_bugs</toc>
- </ignoretocs>
- <ignoreqt_xml>
- <toc>qmake User Guide</toc>
- </ignoreqt_xml>
- </tdevdoctreeview>
- <tdevdebugger>
- <general>
- <dbgshell>libtool</dbgshell>
- <programargs/>
- <gdbpath/>
- <configGdbScript/>
- <runShellScript/>
- <runGdbScript/>
- <breakonloadinglibs>true</breakonloadinglibs>
- <separatetty>false</separatetty>
- <floatingtoolbar>false</floatingtoolbar>
- </general>
- <display>
- <staticmembers>false</staticmembers>
- <demanglenames>true</demanglenames>
- <outputradix>10</outputradix>
- </display>
- </tdevdebugger>
- <tdevfilecreate>
- <filetypes/>
- <useglobaltypes>
- <type ext="ui" />
- <type ext="cpp" />
- <type ext="h" />
- </useglobaltypes>
- </tdevfilecreate>
- <tdevautoproject>
- <make>
- <envvars>
- <envvar value="1" name="WANT_AUTOCONF_2_5" />
- <envvar value="1" name="WANT_AUTOMAKE_1_6" />
- </envvars>
- <abortonerror>true</abortonerror>
- <numberofjobs>1</numberofjobs>
- <dontact>false</dontact>
- <makebin/>
- <prio>0</prio>
- </make>
- <run>
- <directoryradio>build</directoryradio>
- <customdirectory>/</customdirectory>
- <mainprogram>tdefilereplace/tdefilereplace</mainprogram>
- <programargs/>
- <terminal>false</terminal>
- <autocompile>true</autocompile>
- <envvars/>
- </run>
- <general>
- <useconfiguration>default</useconfiguration>
- <activetarget>tdefilereplace</activetarget>
- </general>
- <configurations>
- <default>
- <envvars>
- <envvar value="kommander klinkstatus kxsldbg kimagemapeditor quanta" name="DO_NOT_COMPILE" />
- </envvars>
- <configargs>--enable-debug=full --prefix=/opt/trinity --enable-editors</configargs>
- <builddir>/home/andris/development/build/kde-head/tdewebdev</builddir>
- <topsourcedir>/home/andris/development/sources/kde-head/tdewebdev</topsourcedir>
- <cppflags>-DKDE_NO_COMPAT -DDEBUG_PARSER</cppflags>
- <ldflags/>
- <ccompiler>tdevgccoptions</ccompiler>
- <cxxcompiler>tdevgppoptions</cxxcompiler>
- <f77compiler>tdevpgf77options</f77compiler>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
- <cflags/>
- <cxxflags/>
- <f77flags/>
- </default>
- </configurations>
- </tdevautoproject>
- <cppsupportpart>
- <filetemplates>
- <interfacesuffix>.h</interfacesuffix>
- <implementationsuffix>.cpp</implementationsuffix>
- </filetemplates>
- </cppsupportpart>
- <tdevcppsupport>
- <codecompletion>
- <includeGlobalFunctions>true</includeGlobalFunctions>
- <includeTypes>true</includeTypes>
- <includeEnums>true</includeEnums>
- <includeTypedefs>false</includeTypedefs>
- <automaticCodeCompletion>true</automaticCodeCompletion>
- <automaticArgumentsHint>true</automaticArgumentsHint>
- <automaticHeaderCompletion>true</automaticHeaderCompletion>
- <codeCompletionDelay>250</codeCompletionDelay>
- <argumentsHintDelay>400</argumentsHintDelay>
- <headerCompletionDelay>250</headerCompletionDelay>
- </codecompletion>
- <references/>
- <creategettersetter>
- <prefixGet/>
- <prefixSet>set</prefixSet>
- <prefixVariable>m_,_</prefixVariable>
- <parameterName>theValue</parameterName>
- <inlineGet>true</inlineGet>
- <inlineSet>true</inlineSet>
- </creategettersetter>
- </tdevcppsupport>
- <tdevdocumentation>
- <projectdoc>
- <docsystem/>
- <docurl/>
- <usermanualurl/>
- </projectdoc>
- </tdevdocumentation>
- <tdevcvsservice>
- <recursivewhenupdate>true</recursivewhenupdate>
- <prunedirswhenupdate>true</prunedirswhenupdate>
- <createdirswhenupdate>true</createdirswhenupdate>
- <recursivewhencommitremove>true</recursivewhencommitremove>
- <revertoptions>-C</revertoptions>
- </tdevcvsservice>
-</tdevelop>