summaryrefslogtreecommitdiffstats
path: root/kmail/kmedit.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kmail/kmedit.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/kmedit.cpp')
-rw-r--r--kmail/kmedit.cpp162
1 files changed, 81 insertions, 81 deletions
diff --git a/kmail/kmedit.cpp b/kmail/kmedit.cpp
index b20570f47..bb1bb88f6 100644
--- a/kmail/kmedit.cpp
+++ b/kmail/kmedit.cpp
@@ -43,9 +43,9 @@ using KPIM::MailListDrag;
#include <spellingfilter.h>
#include <ksyntaxhighlighter.h>
-#include <qregexp.h>
-#include <qbuffer.h>
-#include <qevent.h>
+#include <tqregexp.h>
+#include <tqbuffer.h>
+#include <tqevent.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -56,7 +56,7 @@ using KPIM::MailListDrag;
#include <assert.h>
-void KMEdit::contentsDragEnterEvent(QDragEnterEvent *e)
+void KMEdit::contentsDragEnterEvent(TQDragEnterEvent *e)
{
if (e->provides(MailListDrag::format()))
e->accept(true);
@@ -66,7 +66,7 @@ void KMEdit::contentsDragEnterEvent(QDragEnterEvent *e)
return KEdit::contentsDragEnterEvent(e);
}
-void KMEdit::contentsDragMoveEvent(QDragMoveEvent *e)
+void KMEdit::contentsDragMoveEvent(TQDragMoveEvent *e)
{
if (e->provides(MailListDrag::format()))
e->accept();
@@ -76,12 +76,12 @@ void KMEdit::contentsDragMoveEvent(QDragMoveEvent *e)
return KEdit::contentsDragMoveEvent(e);
}
-void KMEdit::keyPressEvent( QKeyEvent* e )
+void KMEdit::keyPressEvent( TQKeyEvent* e )
{
if( e->key() == Key_Return ) {
int line, col;
getCursorPosition( &line, &col );
- QString lineText = text( line );
+ TQString lineText = text( line );
// returns line with additional trailing space (bug in Qt?), cut it off
lineText.truncate( lineText.length() - 1 );
// special treatment of quoted lines only if the cursor is neither at
@@ -114,7 +114,7 @@ void KMEdit::keyPressEvent( QKeyEvent* e )
// The cursor position might have changed unpredictably if there was selected
// text which got replaced by a new line, so we query it again:
getCursorPosition( &line, &col );
- QString newLine = text( line );
+ TQString newLine = text( line );
// remove leading white space from the new line and instead
// add the quote indicators of the previous line
unsigned int leadingWhiteSpaceCount = 0;
@@ -139,19 +139,19 @@ void KMEdit::keyPressEvent( QKeyEvent* e )
KEdit::keyPressEvent( e );
}
-void KMEdit::contentsDropEvent(QDropEvent *e)
+void KMEdit::contentsDropEvent(TQDropEvent *e)
{
if (e->provides(MailListDrag::format())) {
// Decode the list of serial numbers stored as the drag data
- QByteArray serNums;
+ TQByteArray serNums;
MailListDrag::decode( e, serNums );
- QBuffer serNumBuffer(serNums);
+ TQBuffer serNumBuffer(serNums);
serNumBuffer.open(IO_ReadOnly);
- QDataStream serNumStream(&serNumBuffer);
+ TQDataStream serNumStream(&serNumBuffer);
Q_UINT32 serNum;
KMFolder *folder = 0;
int idx;
- QPtrList<KMMsgBase> messageList;
+ TQPtrList<KMMsgBase> messageList;
while (!serNumStream.atEnd()) {
KMMsgBase *msgBase = 0;
serNumStream >> serNum;
@@ -193,9 +193,9 @@ void KMEdit::contentsDropEvent(QDropEvent *e)
break;
}
}
- else if ( QTextDrag::canDecode( e ) ) {
- QString s;
- if ( QTextDrag::decode( e, s ) )
+ else if ( TQTextDrag::canDecode( e ) ) {
+ TQString s;
+ if ( TQTextDrag::decode( e, s ) )
insert( s );
}
else
@@ -209,7 +209,7 @@ void KMEdit::contentsDropEvent(QDropEvent *e)
}
}
-KMEdit::KMEdit(QWidget *parent, KMComposeWin* composer,
+KMEdit::KMEdit(TQWidget *parent, KMComposeWin* composer,
KSpellConfig* autoSpellConfig,
const char *name)
: KEdit( parent, name ),
@@ -236,22 +236,22 @@ void KMEdit::initializeAutoSpellChecking()
{
if ( mSpellChecker )
return; // already initialized
- QColor defaultColor1( 0x00, 0x80, 0x00 ); // defaults from kmreaderwin.cpp
- QColor defaultColor2( 0x00, 0x70, 0x00 );
- QColor defaultColor3( 0x00, 0x60, 0x00 );
- QColor defaultForeground( kapp->palette().active().text() );
+ TQColor defaultColor1( 0x00, 0x80, 0x00 ); // defaults from kmreaderwin.cpp
+ TQColor defaultColor2( 0x00, 0x70, 0x00 );
+ TQColor defaultColor3( 0x00, 0x60, 0x00 );
+ TQColor defaultForeground( kapp->palette().active().text() );
- QColor c = Qt::red;
+ TQColor c = Qt::red;
KConfigGroup readerConfig( KMKernel::config(), "Reader" );
- QColor col1;
+ TQColor col1;
if ( !readerConfig.readBoolEntry( "defaultColors", true ) )
col1 = readerConfig.readColorEntry( "ForegroundColor", &defaultForeground );
else
col1 = defaultForeground;
- QColor col2 = readerConfig.readColorEntry( "QuotedText3", &defaultColor3 );
- QColor col3 = readerConfig.readColorEntry( "QuotedText2", &defaultColor2 );
- QColor col4 = readerConfig.readColorEntry( "QuotedText1", &defaultColor1 );
- QColor misspelled = readerConfig.readColorEntry( "MisspelledColor", &c );
+ TQColor col2 = readerConfig.readColorEntry( "QuotedText3", &defaultColor3 );
+ TQColor col3 = readerConfig.readColorEntry( "QuotedText2", &defaultColor2 );
+ TQColor col4 = readerConfig.readColorEntry( "QuotedText1", &defaultColor1 );
+ TQColor misspelled = readerConfig.readColorEntry( "MisspelledColor", &c );
mSpellChecker = new KDictSpellingHighlighter( this, /*active*/ true,
/*autoEnabled*/ false,
/*spellColor*/ misspelled,
@@ -259,17 +259,17 @@ void KMEdit::initializeAutoSpellChecking()
col1, col2, col3, col4,
mSpellConfig );
- connect( mSpellChecker, SIGNAL(newSuggestions(const QString&, const QStringList&, unsigned int)),
- this, SLOT(addSuggestion(const QString&, const QStringList&, unsigned int)) );
+ connect( mSpellChecker, TQT_SIGNAL(newSuggestions(const TQString&, const TQStringList&, unsigned int)),
+ this, TQT_SLOT(addSuggestion(const TQString&, const TQStringList&, unsigned int)) );
}
-QPopupMenu *KMEdit::createPopupMenu( const QPoint& pos )
+TQPopupMenu *KMEdit::createPopupMenu( const TQPoint& pos )
{
enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll };
- QPopupMenu *menu = KEdit::createPopupMenu( pos );
- if ( !QApplication::clipboard()->image().isNull() ) {
+ TQPopupMenu *menu = KEdit::createPopupMenu( pos );
+ if ( !TQApplication::clipboard()->image().isNull() ) {
int id = menu->idAt(0);
menu->setItemEnabled( id - IdPaste, true);
}
@@ -283,7 +283,7 @@ void KMEdit::deleteAutoSpellChecking()
mSpellChecker =0;
}
-void KMEdit::addSuggestion(const QString& text, const QStringList& lst, unsigned int )
+void KMEdit::addSuggestion(const TQString& text, const TQStringList& lst, unsigned int )
{
mReplacements[text] = lst;
}
@@ -308,9 +308,9 @@ KMEdit::~KMEdit()
-QString KMEdit::brokenText()
+TQString KMEdit::brokenText()
{
- QString temp, line;
+ TQString temp, line;
int num_lines = numLines();
for (int i = 0; i < num_lines; ++i)
@@ -344,14 +344,14 @@ unsigned int KMEdit::lineBreakColumn() const
}
-bool KMEdit::eventFilter(QObject*o, QEvent* e)
+bool KMEdit::eventFilter(TQObject*o, TQEvent* e)
{
if (o == this)
KCursor::autoHideEventFilter(o, e);
- if (e->type() == QEvent::KeyPress)
+ if (e->type() == TQEvent::KeyPress)
{
- QKeyEvent *k = (QKeyEvent*)e;
+ TQKeyEvent *k = (TQKeyEvent*)e;
if (mUseExtEditor) {
if (k->key() == Key_Up)
@@ -365,7 +365,7 @@ bool KMEdit::eventFilter(QObject*o, QEvent* e)
(k->key() == Key_Meta) || (k->key() == Key_Alt) )
return true;
if (mExtEditorTempFile) return true;
- QString sysLine = mExtEditor;
+ TQString sysLine = mExtEditor;
mExtEditorTempFile = new KTempFile();
mExtEditorTempFile->setAutoDelete(true);
@@ -383,8 +383,8 @@ bool KMEdit::eventFilter(QObject*o, QEvent* e)
*mExtEditorProcess << sysLine.left(sysLine.find(" ")).local8Bit();
sysLine.remove(0, sysLine.find(" ") + 1);
}
- connect(mExtEditorProcess, SIGNAL(processExited(KProcess*)),
- SLOT(slotExternalEditorDone(KProcess*)));
+ connect(mExtEditorProcess, TQT_SIGNAL(processExited(KProcess*)),
+ TQT_SLOT(slotExternalEditorDone(KProcess*)));
if (!mExtEditorProcess->start())
{
KMessageBox::error( topLevelWidget(),
@@ -392,8 +392,8 @@ bool KMEdit::eventFilter(QObject*o, QEvent* e)
killExternalEditor();
} else {
mExtEditorTempFileWatcher = new KDirWatch( this, "mExtEditorTempFileWatcher" );
- connect( mExtEditorTempFileWatcher, SIGNAL(dirty(const QString&)),
- SLOT(slotExternalEditorTempFileChanged(const QString&)) );
+ connect( mExtEditorTempFileWatcher, TQT_SIGNAL(dirty(const TQString&)),
+ TQT_SLOT(slotExternalEditorTempFileChanged(const TQString&)) );
mExtEditorTempFileWatcher->addFile( mExtEditorTempFile->name() );
}
return true;
@@ -417,24 +417,24 @@ bool KMEdit::eventFilter(QObject*o, QEvent* e)
}
}
- } else if ( e->type() == QEvent::ContextMenu ) {
- QContextMenuEvent *event = (QContextMenuEvent*) e;
+ } else if ( e->type() == TQEvent::ContextMenu ) {
+ TQContextMenuEvent *event = (TQContextMenuEvent*) e;
int para = 1, charPos, firstSpace, lastSpace;
//Get the character at the position of the click
charPos = charAt( viewportToContents(event->pos()), &para );
- QString paraText = text( para );
+ TQString paraText = text( para );
if( !paraText.at(charPos).isSpace() )
{
//Get word right clicked on
- const QRegExp wordBoundary( "[\\s\\W]" );
+ const TQRegExp wordBoundary( "[\\s\\W]" );
firstSpace = paraText.findRev( wordBoundary, charPos ) + 1;
lastSpace = paraText.find( wordBoundary, charPos );
if( lastSpace == -1 )
lastSpace = paraText.length();
- QString word = paraText.mid( firstSpace, lastSpace - firstSpace );
+ TQString word = paraText.mid( firstSpace, lastSpace - firstSpace );
//Continue if this word was misspelled
if( !word.isEmpty() && mReplacements.contains( word ) )
{
@@ -442,18 +442,18 @@ bool KMEdit::eventFilter(QObject*o, QEvent* e)
p.insertTitle( i18n("Suggestions") );
//Add the suggestions to the popup menu
- QStringList reps = mReplacements[word];
+ TQStringList reps = mReplacements[word];
if( reps.count() > 0 )
{
int listPos = 0;
- for ( QStringList::Iterator it = reps.begin(); it != reps.end(); ++it ) {
+ for ( TQStringList::Iterator it = reps.begin(); it != reps.end(); ++it ) {
p.insertItem( *it, listPos );
listPos++;
}
}
else
{
- p.insertItem( QString::fromLatin1("No Suggestions"), -2 );
+ p.insertItem( TQString::fromLatin1("No Suggestions"), -2 );
}
//Execute the popup inline
@@ -476,9 +476,9 @@ bool KMEdit::eventFilter(QObject*o, QEvent* e)
return true;
}
}
- } else if ( e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut ) {
- QFocusEvent *fe = static_cast<QFocusEvent*>(e);
- if(! (fe->reason() == QFocusEvent::ActiveWindow || fe->reason() == QFocusEvent::Popup) )
+ } else if ( e->type() == TQEvent::FocusIn || e->type() == TQEvent::FocusOut ) {
+ TQFocusEvent *fe = static_cast<TQFocusEvent*>(e);
+ if(! (fe->reason() == TQFocusEvent::ActiveWindow || fe->reason() == TQFocusEvent::Popup) )
emit focusChanged( fe->gotFocus() );
}
@@ -503,7 +503,7 @@ int KMEdit::autoSpellChecking( bool on )
}
-void KMEdit::slotExternalEditorTempFileChanged( const QString & fileName ) {
+void KMEdit::slotExternalEditorTempFileChanged( const TQString & fileName ) {
if ( !mExtEditorTempFile )
return;
if ( fileName != mExtEditorTempFile->name() )
@@ -512,7 +512,7 @@ void KMEdit::slotExternalEditorTempFileChanged( const QString & fileName ) {
setAutoUpdate(false);
clear();
- insertLine(QString::fromLocal8Bit(KPIM::kFileToString( fileName, true, false )), -1);
+ insertLine(TQString::fromLocal8Bit(KPIM::kFileToString( fileName, true, false )), -1);
setAutoUpdate(true);
repaint();
}
@@ -559,25 +559,25 @@ void KMEdit::spellcheck()
// if (textFormat() == Qt::RichText ) {
// kdDebug(5006) << "KMEdit::spellcheck, spellchecking for RichText" << endl;
// mKSpell = new KSpell(this, i18n("Spellcheck - KMail"), this,
-// SLOT(slotSpellcheck2(KSpell*)),0,true,false,KSpell::HTML);
+// TQT_SLOT(slotSpellcheck2(KSpell*)),0,true,false,KSpell::HTML);
// }
// else {
mKSpell = new KSpell(this, i18n("Spellcheck - KMail"), this,
- SLOT(slotSpellcheck2(KSpell*)));
+ TQT_SLOT(slotSpellcheck2(KSpell*)));
// }
- QStringList l = KSpellingHighlighter::personalWords();
- for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
+ TQStringList l = KSpellingHighlighter::personalWords();
+ for ( TQStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
mKSpell->addPersonal( *it );
}
- connect (mKSpell, SIGNAL( death()),
- this, SLOT (slotSpellDone()));
- connect (mKSpell, SIGNAL (misspelling (const QString &, const QStringList &, unsigned int)),
- this, SLOT (slotMisspelling (const QString &, const QStringList &, unsigned int)));
- connect (mKSpell, SIGNAL (corrected (const QString &, const QString &, unsigned int)),
- this, SLOT (slotCorrected (const QString &, const QString &, unsigned int)));
- connect (mKSpell, SIGNAL (done(const QString &)),
- this, SLOT (slotSpellResult (const QString&)));
+ connect (mKSpell, TQT_SIGNAL( death()),
+ this, TQT_SLOT (slotSpellDone()));
+ connect (mKSpell, TQT_SIGNAL (misspelling (const TQString &, const TQStringList &, unsigned int)),
+ this, TQT_SLOT (slotMisspelling (const TQString &, const TQStringList &, unsigned int)));
+ connect (mKSpell, TQT_SIGNAL (corrected (const TQString &, const TQString &, unsigned int)),
+ this, TQT_SLOT (slotCorrected (const TQString &, const TQString &, unsigned int)));
+ connect (mKSpell, TQT_SIGNAL (done(const TQString &)),
+ this, TQT_SLOT (slotSpellResult (const TQString&)));
}
void KMEdit::cut()
@@ -606,12 +606,12 @@ void KMEdit::paste()
mComposer->paste( mPasteMode );
}
-// KMEdit indirectly inherits from QTextEdit, which has virtual paste() method,
+// KMEdit indirectly inherits from TQTextEdit, which has virtual paste() method,
// but it controls whether it pastes clipboard or selection by an internal
// flag that is not accessible in any way, so paste() being virtual is actually
// useless, because reimplementations can't known where to paste from anyway.
// Roll our own internal flag.
-void KMEdit::contentsMouseReleaseEvent( QMouseEvent * e )
+void KMEdit::contentsMouseReleaseEvent( TQMouseEvent * e )
{
if( e->button() != Qt::MidButton )
return KEdit::contentsMouseReleaseEvent( e );
@@ -620,26 +620,26 @@ void KMEdit::contentsMouseReleaseEvent( QMouseEvent * e )
mPasteMode = QClipboard::Clipboard;
}
-void KMEdit::slotMisspelling(const QString &text, const QStringList &lst, unsigned int pos)
+void KMEdit::slotMisspelling(const TQString &text, const TQStringList &lst, unsigned int pos)
{
- kdDebug(5006)<<"void KMEdit::slotMisspelling(const QString &text, const QStringList &lst, unsigned int pos) : "<<text <<endl;
+ kdDebug(5006)<<"void KMEdit::slotMisspelling(const TQString &text, const TQStringList &lst, unsigned int pos) : "<<text <<endl;
if( mSpellLineEdit )
mComposer->sujectLineWidget()->spellCheckerMisspelling( text, lst, pos);
else
misspelling(text, lst, pos);
}
-void KMEdit::slotCorrected (const QString &oldWord, const QString &newWord, unsigned int pos)
+void KMEdit::slotCorrected (const TQString &oldWord, const TQString &newWord, unsigned int pos)
{
- kdDebug(5006)<<"slotCorrected (const QString &oldWord, const QString &newWord, unsigned int pos) : "<<oldWord<<endl;
+ kdDebug(5006)<<"slotCorrected (const TQString &oldWord, const TQString &newWord, unsigned int pos) : "<<oldWord<<endl;
if( mSpellLineEdit )
mComposer->sujectLineWidget()->spellCheckerCorrected( oldWord, newWord, pos);
else {
unsigned int l = 0;
unsigned int cnt = 0;
bool _bold,_underline,_italic;
- QColor _color;
- QFont _font;
+ TQColor _color;
+ TQFont _font;
posToRowCol (pos, l, cnt);
setCursorPosition(l, cnt+1); // the new word will get the same markup now as the first character of the word
_bold = bold();
@@ -664,11 +664,11 @@ void KMEdit::slotSpellcheck2(KSpell*)
{
spellcheck_start();
- QString quotePrefix;
+ TQString quotePrefix;
if(mComposer && mComposer->msg())
{
int languageNr = GlobalSettings::self()->replyCurrentLanguage();
- ReplyPhrases replyPhrases( QString::number(languageNr) );
+ ReplyPhrases replyPhrases( TQString::number(languageNr) );
replyPhrases.readConfig();
quotePrefix = mComposer->msg()->formatString(
@@ -676,7 +676,7 @@ void KMEdit::slotSpellcheck2(KSpell*)
}
kdDebug(5006) << "spelling: new SpellingFilter with prefix=\"" << quotePrefix << "\"" << endl;
- QTextEdit plaintext;
+ TQTextEdit plaintext;
plaintext.setText(text());
plaintext.setTextFormat(Qt::PlainText);
mSpellingFilter = new SpellingFilter(plaintext.text(), quotePrefix, SpellingFilter::FilterUrls,
@@ -688,7 +688,7 @@ void KMEdit::slotSpellcheck2(KSpell*)
mKSpell->check( mComposer->sujectLineWidget()->text());
}
-void KMEdit::slotSpellResult(const QString &s)
+void KMEdit::slotSpellResult(const TQString &s)
{
if( !mSpellLineEdit)
spellcheck_stop();
@@ -700,7 +700,7 @@ void KMEdit::slotSpellResult(const QString &s)
{
//stop spell check
mSpellLineEdit = false;
- QString tmpText( s );
+ TQString tmpText( s );
tmpText = tmpText.remove('\n');
if( tmpText != mComposer->sujectLineWidget()->text() )