[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: ktexteditor patch
From: Mickael Marchand <marchand () kde ! org>
Date: 2002-08-29 11:31:03
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
here is the patch for kmail adding ktexteditor integration,
that's only the first version, it lacks a few features (wordwrap, encoding, ...)
but you can send mails with it :) (I currently use it with the vim kpart)
I'll add the missing features soon.
Regards,
Mik
PS: please CC any comments, thanks
- --
Mickael Marchand, marchand@kde.org, marchand@freenux.org
KVim maintainer, http://freehackers.org/kvim
"Leading Vim to the K Desktop Environment !"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9bgX3yOYzc4nQ8j0RAsHVAKCnvtYsTj0SXQBsyj4cSbulq8FpowCgiy9t
pYUuqREid0oUACUxNY1bITA=
=2T2o
-----END PGP SIGNATURE-----
["kmail-ktexteditor.diff" (text/x-diff)]
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdenetwork/kmail/Makefile.am,v
retrieving revision 1.152
diff -u -3 -p -r1.152 Makefile.am
--- Makefile.am 2002/08/21 14:08:59 1.152
+++ Makefile.am 2002/08/29 11:12:21
@@ -2,7 +2,7 @@ KDE_CXXFLAGS = $(USE_RTTI) -DQT_NO_COMPA
SUBDIRS = . about pics profiles
INCLUDES = -I$(top_srcdir)/libkdenetwork -I$(top_srcdir)/mimelib $(all_includes)
-LDADD = $(LIB_KHTML) ../libkdenetwork/libkdenetwork.la -lkspell \
../mimelib/libmimelib.la -lkabc +LDADD = $(LIB_KHTML) \
../libkdenetwork/libkdenetwork.la -lkspell ../mimelib/libmimelib.la -lkabc \
-lktexteditor -lkutils
bin_PROGRAMS = kmail
Index: configuredialog.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/configuredialog.cpp,v
retrieving revision 1.299
diff -u -3 -p -r1.299 configuredialog.cpp
--- configuredialog.cpp 2002/08/23 22:18:06 1.299
+++ configuredialog.cpp 2002/08/29 11:12:33
@@ -95,6 +95,7 @@ using KMime::DateFormatter;
#include <qlayout.h>
#include <qtextcodec.h>
#include <qheader.h>
+#include <ktexteditor/editorchooser.h>
#include <qlineedit.h>
#include <qpopupmenu.h>
#include <qcheckbox.h>
@@ -2385,7 +2386,7 @@ ComposerPageGeneralTab::ComposerPageGene
// tmp. vars:
QVBoxLayout *vlay;
QHBoxLayout *hlay;
- QGroupBox *group;
+ QGroupBox *group, *editor;
QLabel *label;
QHBox *hbox;
@@ -2421,6 +2422,12 @@ ComposerPageGeneralTab::ComposerPageGene
connect( mWordWrapCheck, SIGNAL(toggled(bool)),
mWrapColumnSpin, SLOT(setEnabled(bool)) );
+ //ktexteditor stuff
+ editor = new QVGroupBox (i18n("Embedded Editor"), this);
+ editor->layout()->setSpacing( KDialog::spacingHint() );
+ chooser = new KTextEditor::EditorChooser(editor, "Editor chooser");
+ chooser->readAppSetting();
+
// The "exteral editor" group:
group = new QVGroupBox( i18n("External Editor"), this );
group->layout()->setSpacing( KDialog::spacingHint() );
@@ -2450,6 +2457,7 @@ ComposerPageGeneralTab::ComposerPageGene
connect( mExternalEditorCheck, SIGNAL(toggled(bool)),
label, SLOT(setEnabled(bool)) );
+ vlay->addWidget( editor );
vlay->addWidget( group );
vlay->addStretch( 100 );
}
@@ -2501,6 +2509,9 @@ void ComposerPage::GeneralTab::installPr
void ComposerPage::GeneralTab::apply() {
KConfigGroup general( kapp->config(), "General" );
KConfigGroup composer( kapp->config(), "Composer" );
+
+ //ktexteditor
+ chooser->writeAppSetting();
general.writeEntry( "use-external-editor", mExternalEditorCheck->isChecked() );
general.writeEntry( "external-editor", mEditorRequester->url() );
Index: configuredialog_p.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/configuredialog_p.h,v
retrieving revision 1.39
diff -u -3 -p -r1.39 configuredialog_p.h
--- configuredialog_p.h 2002/08/22 22:38:22 1.39
+++ configuredialog_p.h 2002/08/29 11:12:35
@@ -15,6 +15,7 @@
#include <kdialogbase.h>
#include <klistview.h>
+#include <ktexteditor/editorchooser.h>
class QPushButton;
class QLabel;
@@ -548,6 +549,7 @@ public:
void installProfile( KConfig * profile );
protected:
+ KTextEditor::EditorChooser *chooser;
QCheckBox *mAutoAppSignFileCheck;
QCheckBox *mSmartQuoteCheck;
QCheckBox *mPgpAutoSignatureCheck;
Index: kmcomposewin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.cpp,v
retrieving revision 1.574
diff -u -3 -p -r1.574 kmcomposewin.cpp
--- kmcomposewin.cpp 2002/08/27 23:04:00 1.574
+++ kmcomposewin.cpp 2002/08/29 11:13:09
@@ -81,9 +81,20 @@
#include "cryptplugwrapperlist.h"
#include "klistboxdialog.h"
-#include "kmcomposewin.moc"
-
+#include <ktexteditor/editor.h>
+#include <ktexteditor/document.h>
+#include <ktexteditor/view.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/editorchooser.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/searchinterface.h>
+#include <klibloader.h>
+#include <ktrader.h>
+#include <kservice.h>
+#include <kfinddialog.h>
+#include <qregexp.h>
+#include "kmcomposewin.moc"
//-----------------------------------------------------------------------------
KMComposeWin::KMComposeWin( CryptPlugWrapperList * cryptPlugList,
@@ -141,7 +152,6 @@ KMComposeWin::KMComposeWin( CryptPlugWra
bAutoCharset = TRUE;
fixedFontAction = NULL;
mEditor = new KMEdit(mMainWidget, this);
- mEditor->setTextFormat(Qt::PlainText);
disableBreaking = false;
QString tip = i18n("Select email address(es)");
QToolTip::add( mBtnTo, tip );
@@ -215,8 +225,8 @@ KMComposeWin::KMComposeWin( CryptPlugWra
connect(kernel->imapFolderMgr(),SIGNAL(removed(KMFolder*)),
SLOT(slotFolderRemoved(KMFolder*)));
- connect (mEditor, SIGNAL (spellcheck_done(int)),
- this, SLOT (slotSpellcheckDone (int)));
+//XXX connect (mEditor, SIGNAL (spellcheck_done(int)),
+//XXX this, SLOT (slotSpellcheckDone (int)));
mMainWidget->resize(480,510);
setCentralWidget(mMainWidget);
@@ -369,7 +379,7 @@ void KMComposeWin::readColorConfig(void)
mEdtReplyTo->setPalette(mPalette);
mEdtBcc->setPalette(mPalette);
mTransport->setPalette(mPalette);
- mEditor->setPalette(mPalette);
+//XXX mEditor->setPalette(mPalette);
mFcc->setPalette(mPalette);
}
@@ -999,7 +1009,7 @@ void KMComposeWin::setupStatusBar(void)
//-----------------------------------------------------------------------------
void KMComposeWin::updateCursorPosition()
{
- int col,line;
+ int col=0,line=0;
QString temp;
line = mEditor->currentLine();
col = mEditor->currentColumn();
@@ -1016,17 +1026,17 @@ void KMComposeWin::setupEditor(void)
//QPopupMenu* menu;
mEditor->setModified(FALSE);
QFontMetrics fm(mBodyFont);
- mEditor->setTabStopWidth(fm.width(QChar(' ')) * 8);
+//XXX mEditor->setTabStopWidth(fm.width(QChar(' ')) * 8);
//mEditor->setFocusPolicy(QWidget::ClickFocus);
if (mWordWrap)
{
- mEditor->setWordWrap( QMultiLineEdit::FixedColumnWidth );
- mEditor->setWrapColumnOrWidth(mLineBreak);
+//XXX mEditor->setWordWrap( QMultiLineEdit::FixedColumnWidth );
+//XXX mEditor->setWrapColumnOrWidth(mLineBreak);
}
else
{
- mEditor->setWordWrap( QMultiLineEdit::NoWrap );
+//XXX mEditor->setWordWrap( QMultiLineEdit::NoWrap );
}
// Font setup
@@ -1054,7 +1064,7 @@ void KMComposeWin::setupEditor(void)
mEditor->installRBPopup(menu);
*/
updateCursorPosition();
- connect(mEditor,SIGNAL(CursorPositionChanged()),SLOT(updateCursorPosition()));
+//XXX connect(mEditor,SIGNAL(CursorPositionChanged()),SLOT(updateCursorPosition()));
}
//-----------------------------------------------------------------------------
@@ -1063,7 +1073,8 @@ void KMComposeWin::verifyWordWrapLengthI
int maxLineLength = 0;
int curPos;
int oldPos = 0;
- if (mEditor->QMultiLineEdit::wordWrap() == QMultiLineEdit::FixedColumnWidth) {
+/*XXX function unused, no matter
+ if (mEditor->QMultiLineEdit::wordWrap() == QMultiLineEdit::FixedColumnWidth) {
for (curPos = 0; curPos < (int)body.length(); ++curPos)
if (body[curPos] == '\n') {
if ((curPos - oldPos) > maxLineLength)
@@ -1074,7 +1085,7 @@ void KMComposeWin::verifyWordWrapLengthI
maxLineLength = curPos - oldPos;
if (mEditor->wrapColumnOrWidth() < maxLineLength) // column
mEditor->setWrapColumnOrWidth(maxLineLength);
- }
+ }*/
}
//-----------------------------------------------------------------------------
@@ -1209,13 +1220,12 @@ void KMComposeWin::setMsg(KMMessage* new
// are opened for editting in the composer (cf. Bug#41102) I comment it
// out. Ingo, 2002-04-21
//verifyWordWrapLengthIsAdequate(bodyDecoded);
-
+
QTextCodec *codec = KMMsgBase::codecForName(mCharset);
if (codec)
- mEditor->setText(codec->toUnicode(bodyDecoded));
+ mEditor->setText(codec->toUnicode(bodyDecoded)+"\n");
else
- mEditor->setText(QString::fromLocal8Bit(bodyDecoded));
- mEditor->insertLine("\n", -1);
+ mEditor->setText(QString::fromLocal8Bit(bodyDecoded)+"\n");
} else mEditor->setText("");
for(i=firstAttachment; i<num; i++)
{
@@ -1240,10 +1250,12 @@ void KMComposeWin::setMsg(KMMessage* new
mEditor->setText(QString::fromLocal8Bit(bodyDecoded));
}
+ kdDebug() << "setMsg :setCharset " << endl;
setCharset(mCharset);
if( mAutoSign && mayAutoSign )
{
+ kdDebug() << "setMsg : autoSign " << endl;
//
// Espen 2000-05-16
// Delay the signature appending. It may start a fileseletor.
@@ -1252,6 +1264,7 @@ void KMComposeWin::setMsg(KMMessage* new
//
QTimer::singleShot( 0, this, SLOT(slotAppendSignature()) );
}
+ kdDebug() << "setMsg : setModified " << endl;
mEditor->setModified(FALSE);
}
@@ -1908,6 +1921,7 @@ bool KMComposeWin::composeMessage( Crypt
bool KMComposeWin::queryExit ()
{
+ slotClose();
return true;
}
@@ -2542,7 +2556,8 @@ QCString KMComposeWin::breakLinesAndAppl
if (disableBreaking)
text = mEditor->text();
else
- text = mEditor->brokenText();
+//XXX text = mEditor->brokenText();
+ text = mEditor->text();
text.truncate(text.length()); // to ensure text.size()==text.length()+1
@@ -3544,7 +3559,7 @@ void KMComposeWin::slotAttachFileResult(
}
if ((*it).insert)
{
- int col, line;
+ uint col, line;
mEditor->getCursorPosition(&line, &col);
(*it).data.resize((*it).data.size() + 1);
(*it).data[(*it).data.size() - 1] = '\0';
@@ -3890,8 +3905,9 @@ void KMComposeWin::slotReplace()
//-----------------------------------------------------------------------------
void KMComposeWin::slotUpdateFont()
{
- mEditor->setFont( fixedFontAction && (fixedFontAction->isChecked())
- ? mFixedFont : mBodyFont );
+ /*XXX Adding a font interface to KTextEditor would be great ;)
+ * mEditor->setFont( fixedFontAction && (fixedFontAction->isChecked())
+ ? mFixedFont : mBodyFont ); */
}
//-----------------------------------------------------------------------------
@@ -3977,6 +3993,8 @@ void KMComposeWin::slotMarkAll()
//-----------------------------------------------------------------------------
void KMComposeWin::slotClose()
{
+ kdDebug(5006) << "KMComposeWin::slotClose(). " << endl;
+ if (mEditor) mEditor->closeURL();
close(FALSE);
}
@@ -4041,7 +4059,7 @@ void KMComposeWin::slotSignToggled(bool
//-----------------------------------------------------------------------------
void KMComposeWin::slotWordWrapToggled(bool on)
{
- if (on)
+/*XXX if (on)
{
mEditor->setWordWrap( QMultiLineEdit::FixedColumnWidth );
mEditor->setWrapColumnOrWidth(mLineBreak);
@@ -4049,7 +4067,7 @@ void KMComposeWin::slotWordWrapToggled(b
else
{
mEditor->setWordWrap( QMultiLineEdit::NoWrap );
- }
+ }*/
}
@@ -4183,7 +4201,8 @@ bool KMComposeWin::doSend(int aSendNow,
mAutoDeleteMsg = FALSE;
mFolder = NULL;
- close();
+ //close();
+ slotClose();
return true;
}
@@ -4277,6 +4296,7 @@ void KMComposeWin::slotSelectCrypto()
void KMComposeWin::slotAppendSignature()
{
+ kdDebug() << "setMsg : appendSignature " << endl;
bool mod = mEditor->isModified();
const KMIdentity & ident =
@@ -4322,10 +4342,10 @@ void KMComposeWin::slotAppendSignature()
mOldSigText = sigText;
if( !sigText.isEmpty() )
{
- mEditor->sync();
- mEditor->append("\n");
- mEditor->append(sigText);
- mEditor->update();
+/*XXX mEditor->sync();*/
+ mEditor->insertLine("\n",-1);
+ mEditor->insertLine(sigText,-1);
+// mEditor->update();
mEditor->setModified(mod);
mEditor->setContentsPos( 0, 0 );
}
@@ -4341,7 +4361,7 @@ void KMComposeWin::slotHelp()
//-----------------------------------------------------------------------------
void KMComposeWin::slotCleanSpace()
{
- mEditor->cleanWhiteSpace();
+ //XXX mEditor->cleanWhiteSpace();
}
@@ -4356,7 +4376,7 @@ void KMComposeWin::slotSpellcheck()
this, SLOT (spell_progress (unsigned)));
*/
- mEditor->spellcheck();
+//XXX mEditor->spellcheck();
}
@@ -4579,7 +4599,7 @@ void KMComposeWin::setReplyFocus( bool h
{
mEditor->setFocus();
if ( hasMessage )
- mEditor->setCursorPosition( 1, 0 );
+ mEditor->setContentsPos( 1, 0 );
}
void KMComposeWin::slotCompletionModeChanged( KGlobalSettings::Completion mode)
@@ -4826,7 +4846,6 @@ bool KMLineEdit::eventFilter(QObject *o,
return TRUE;
}
// ---sven's Return is same Tab and arrow key navigation end ---
-
}
return KMLineEditInherited::eventFilter(o, e);
}
@@ -5092,159 +5111,159 @@ void KMLineEdit::dropEvent(QDropEvent *e
//=============================================================================
//
// Class KMEdit
+// updated to KTextEditor by Mickael Marchand (Mikmak) <marchand@kde.org>
//
//=============================================================================
KMEdit::KMEdit(QWidget *parent, KMComposeWin* composer,
- const char *name):
- KMEditInherited(parent, name)
+ const char *name):
+QVBox(parent, name)
{
- mComposer = composer;
- installEventFilter(this);
- KCursor::setAutoHideCursor( this, true, true );
+ mComposer = composer;
+ extEditor = false; // the default is to use ourself
+ mKSpell = NULL;
+ mSpellingFilter = 0;
+ mTempFile = NULL;
+ mExtEditorProcess = NULL;
- extEditor = false; // the default is to use ourself
-
- mKSpell = NULL;
- mSpellingFilter = 0;
- mTempFile = NULL;
- mExtEditorProcess = NULL;
+ editor=KTextEditor::EditorChooser::createDocument(this,"KTextEditor::Document");
+ if (editor) editorView = editor->createView(this, "KTextEditor part");
}
-
//-----------------------------------------------------------------------------
KMEdit::~KMEdit()
{
-
- removeEventFilter(this);
-
+ kdDebug(5006) << "KMEdit::~KMEdit. " << endl;
if (mKSpell) delete mKSpell;
+ if (editor) {
+ editor->closeURL();
+ delete editor;
+ }
+}
+void KMEdit::closeURL() {
+ kdDebug(5006) << "KMEdit::closeURL(). " << endl;
+ editor->closeURL();
}
+void KMEdit::setModified(bool rw) {
+ editor->setModified(rw);
+}
-//-----------------------------------------------------------------------------
-QString KMEdit::brokenText()
-{
- QString temp, line;
+bool KMEdit::isModified() {
+ return editor->isModified();
+}
- int num_lines = numLines();
- for (int i = 0; i < num_lines; ++i)
- {
- int lastLine = 0;
- line = textLine(i);
- for (int j = 0; j < (int)line.length(); ++j)
- {
- if (lineOfChar(i, j) > lastLine)
- {
- lastLine = lineOfChar(i, j);
- temp += '\n';
- }
- temp += line[j];
- }
- if (i + 1 < num_lines) temp += '\n';
- }
+QString KMEdit::text() {
+ KTextEditor::EditInterface *editiface = \
dynamic_cast<KTextEditor::EditInterface*>(editor); + QString text = \
editiface->text(); + kdDebug() << "got text : " << text << endl;
+ return text;
+}
- return temp;
+void KMEdit::setText(QString text) {
+ kdDebug() << "kmail->setText "<< endl;
+ QString text2(text);
+ text2.setLength(text2.length());
+ KTextEditor::EditInterface *editiface = \
dynamic_cast<KTextEditor::EditInterface*>(editor); + editiface->setText(text2);
+ kdDebug() << "kmail->setText success" << endl;
}
-//-----------------------------------------------------------------------------
-bool KMEdit::eventFilter(QObject*o, QEvent* e)
-{
- if (o == this)
- KCursor::autoHideEventFilter(o, e);
+int KMEdit::currentLine() {
+ KTextEditor::ViewCursorInterface *cursoriface = \
dynamic_cast<KTextEditor::ViewCursorInterface*>(editorView); + int line = \
cursoriface->cursorLine(); + kdDebug() << "current line : " << line << endl;
+ return line;
+}
- if (e->type() == QEvent::KeyPress)
- {
- QKeyEvent *k = (QKeyEvent*)e;
+int KMEdit::currentColumn() {
+ KTextEditor::ViewCursorInterface *cursoriface = \
dynamic_cast<KTextEditor::ViewCursorInterface*>(editorView); + int col = \
cursoriface->cursorColumn(); + kdDebug() << "current col : " << col << endl;
+ return col;
+}
- if (extEditor) {
- if (k->key() == Key_Up)
- {
- mComposer->focusNextPrevEdit(0, false); //take me up
- return TRUE;
- }
+void KMEdit::insertLine(QString text, int position) {
+ kdDebug(5006) << "KMEdit::insertLine(). " << position << endl;
+ KTextEditor::EditInterface *editiface = \
dynamic_cast<KTextEditor::EditInterface*>(editor); + \
editiface->insertLine(position,text); +}
- if (mTempFile) return TRUE;
- QRegExp repFn("\\%f");
- QString sysLine = mExtEditor;
- mTempFile = new KTempFile();
-
- mTempFile->setAutoDelete(true);
-
- fprintf(mTempFile->fstream(), "%s", (const char *)text().local8Bit());
-
- mTempFile->close();
- // replace %f in the system line
- sysLine.replace(repFn, mTempFile->name());
- mExtEditorProcess = new KProcess();
- sysLine += " ";
- while (!sysLine.isEmpty())
- {
- *mExtEditorProcess << sysLine.left(sysLine.find(" ")).local8Bit();
- sysLine.remove(0, sysLine.find(" ") + 1);
- }
- connect(mExtEditorProcess, SIGNAL(processExited(KProcess*)),
- SLOT(slotExternalEditorDone(KProcess*)));
- if (!mExtEditorProcess->start())
- {
- KMessageBox::error(NULL, i18n("Unable to start external editor."));
- delete mExtEditorProcess;
- delete mTempFile;
- mExtEditorProcess = NULL;
- mTempFile = NULL;
- }
+void KMEdit::getCursorPosition(uint *line, uint *column) {
+ KTextEditor::ViewCursorInterface *cursoriface = \
dynamic_cast<KTextEditor::ViewCursorInterface*>(editorView); + \
cursoriface->cursorPosition(line,column); +}
- return TRUE;
- } else {
- // ---sven's Arrow key navigation start ---
- // Key Up in first line takes you to Subject line.
- if (k->key() == Key_Up && k->state() != ShiftButton && currentLine() == 0
- && lineOfChar(0, currentColumn()) == 0)
- {
- deselect();
- mComposer->focusNextPrevEdit(0, false); //take me up
- return TRUE;
- }
- // ---sven's Arrow key navigation end ---
+void KMEdit::insertAt(QString text, int line, int column) {
+ kdDebug(5006) << "KMEdit::insertAt(). " << line << " " << column << endl;
+ KTextEditor::EditInterface *editiface = \
dynamic_cast<KTextEditor::EditInterface*>(editor); + \
editiface->insertText(line,column,text); +}
- if (k->key() == Key_Backtab && k->state() == ShiftButton)
- {
- deselect();
- mComposer->focusNextPrevEdit(0, false);
- return TRUE;
- }
+void KMEdit::search() {
+ KTextEditor::SearchInterface *searchiface = \
dynamic_cast<KTextEditor::SearchInterface*>(editor); + if (searchiface==NULL) \
return; // no search support for this part +
+ //create the dialog
+ KFindDialog find (this, 0, KFindDialog::FromCursor | KFindDialog::CaseSensitive | \
KFindDialog::FindBackwards | KFindDialog::RegularExpression, QStringList(), false); \
+ if (find.exec() != QDialog::Accepted) + return;
+
+ //do the search
+ unsigned int *line;
+ unsigned int *column;
+ unsigned int *len;
+ unsigned int startLine=0;
+ unsigned int startColumn=0;
- }
+ bool stop=false;
+ long options = find.options();
+ bool fromcursor=options & KFindDialog::FromCursor;
+ bool casesensitive=options & KFindDialog::CaseSensitive;
+ bool findbackwards=options & KFindDialog::FindBackwards;
+ bool regexp=options & KFindDialog::RegularExpression;
+
+ if (fromcursor) {
+ unsigned int *l, *c;
+ getCursorPosition(l,c);
+ startLine = *l;
+ startColumn = *c;
}
- else if (e->type() == QEvent::Drop)
- {
- KURL::List urlList;
- QDropEvent *de = static_cast<QDropEvent*>(e);
- if(QUriDrag::canDecode(de) && KURLDrag::decode( de, urlList ))
- {
- for (KURL::List::Iterator it = urlList.begin(); it != urlList.end(); ++it)
- mComposer->addAttach(*it);
- return TRUE;
- }
+
+ while (!stop) {
+ if (regexp)
+ stop = ! searchiface->searchText(startLine, startColumn, QRegExp(find.pattern(), \
casesensitive), line, column, len, findbackwards ); + else
+ stop = ! searchiface->searchText(startLine, startColumn, find.pattern(), line , \
column, len, casesensitive, findbackwards); +
+ startLine = *line;
+ startColumn = *column;
}
+}
- return KMEditInherited::eventFilter(o, e);
+void KMEdit::replace() {
+ //TODO
}
+void KMEdit::setContentsPos(int line, int column) {
+ KTextEditor::ViewCursorInterface *cursoriface = \
dynamic_cast<KTextEditor::ViewCursorInterface*>(editorView); + \
cursoriface->setCursorPosition(line,column); +}
//-----------------------------------------------------------------------------
void KMEdit::slotExternalEditorDone(KProcess* proc)
{
assert(proc == mExtEditorProcess);
- setAutoUpdate(false);
- clear();
+ /*XXX setAutoUpdate(false);*/
+ KTextEditor::EditInterface *editiface = \
dynamic_cast<KTextEditor::EditInterface*>(editor); + editiface->clear();
// read data back in from file
- insertLine(QString::fromLocal8Bit(kFileToString(mTempFile->name(),
- TRUE, FALSE)), -1);
+ editiface->insertLine(-1, QString::fromLocal8Bit(kFileToString(mTempFile->name(),
+ TRUE, FALSE)));
- setAutoUpdate(true);
- repaint();
+/*XXX setAutoUpdate(true);*/
+/* repaint();*/
delete proc;
delete mTempFile;
mTempFile = NULL;
@@ -5271,7 +5290,7 @@ void KMEdit::spellcheck()
//-----------------------------------------------------------------------------
void KMEdit::slotSpellcheck2(KSpell*)
{
- spellcheck_start();
+//XXX spellcheck_start();
QString quotePrefix;
if(mComposer && mComposer->msg())
@@ -5288,22 +5307,22 @@ void KMEdit::slotSpellcheck2(KSpell*)
}
kdDebug(5006) << "spelling: new SpellingFilter with prefix=\"" << quotePrefix << \
"\"" << endl;
- mSpellingFilter = new SpellingFilter(text(), quotePrefix, \
SpellingFilter::FilterUrls, +/*XXX mSpellingFilter = new SpellingFilter(text(), \
quotePrefix, SpellingFilter::FilterUrls, SpellingFilter::FilterEmailAddresses);
- mKSpell->check(mSpellingFilter->filteredText());
+ mKSpell->check(mSpellingFilter->filteredText());*/
}
//-----------------------------------------------------------------------------
void KMEdit::slotSpellResult(const QString &)
{
- spellcheck_stop();
+//XXX spellcheck_stop();
int dlgResult = mKSpell->dlgResult();
if ( dlgResult == KS_CANCEL )
{
kdDebug(5006) << "spelling: canceled - restoring text from SpellingFilter" << \
endl;
- setText(mSpellingFilter->originalText());
+//XXX setText(mSpellingFilter->originalText());
}
mKSpell->cleanUp();
@@ -5328,8 +5347,8 @@ void KMEdit::slotSpellDone()
}
else if (status == KSpell::Crashed)
{
- spellcheck_stop();
+//XXX spellcheck_stop();
KMessageBox::sorry(this, i18n("ISpell/Aspell seems to have crashed."));
- emit spellcheck_done( KS_CANCEL );
+//XXX emit spellcheck_done( KS_CANCEL );
}
}
Index: kmcomposewin.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.h,v
retrieving revision 1.167
diff -u -3 -p -r1.167 kmcomposewin.h
--- kmcomposewin.h 2002/08/23 19:56:02 1.167
+++ kmcomposewin.h 2002/08/29 11:13:11
@@ -27,6 +27,11 @@
#include "cryptplugwrapper.h"
+#include <ktexteditor/document.h>
+#include <ktexteditor/view.h>
+#include <qvbox.h>
+class QVBox;
+
class _StringPair {
public:
QString name;
@@ -63,10 +68,10 @@ class SpellingFilter;
typedef QPtrList<KMMessagePart> KMMsgPartList;
-
//-----------------------------------------------------------------------------
#define KMEditInherited KEdit
-class KMEdit: public KEdit
+
+class KMEdit: public QVBox
{
Q_OBJECT
public:
@@ -90,6 +95,29 @@ public:
inline void setExternalEditor(bool extEd) { extEditor=extEd; }
inline void setExternalEditorPath(QString path) { mExtEditor=path; }
+ void setModified(bool);
+ bool isModified();
+
+ void closeURL();
+ QString text();
+
+ void setText(QString text);
+
+ int currentLine();
+
+ int currentColumn();
+
+ void insertLine(QString text, int position);
+
+ void getCursorPosition(uint *line, uint *column);
+
+ void insertAt(QString text, int line, int column);
+
+ void search();
+
+ void replace();
+ void setContentsPos(int,int);
+
signals:
void spellcheck_done(int result);
public slots:
@@ -102,7 +130,7 @@ protected:
/**
* Event filter that does Tab-key handling.
*/
- virtual bool eventFilter(QObject*, QEvent*);
+// virtual bool eventFilter(QObject*, QEvent*);
KMComposeWin* mComposer;
private:
@@ -112,6 +140,8 @@ private:
KProcess *mExtEditorProcess;
bool extEditor;
QString mExtEditor;
+ KTextEditor::Document *editor;
+ KTextEditor::View *editorView;
};
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic