diff --git a/kmcomposewin.cpp b/kmcomposewin.cpp index aa9a5ac81..4f51d232e 100644 --- a/kmcomposewin.cpp +++ b/kmcomposewin.cpp @@ -3916,93 +3916,6 @@ void KMLineEdit::editRecentAddresses() } } -#if 0 -//----------------------------------------------------------------------------- -void KMLineEdit::dropEvent(QDropEvent *e) -{ - KURL::List uriList; - if(KURLDrag::decode( e, uriList )) - { - for (KURL::List::ConstIterator it = uriList.begin(); it != uriList.end(); ++it) - { - smartInsert( (*it).url() ); - } - } - else { - if (m_useCompletion) - m_smartPaste = true; - QLineEdit::dropEvent(e); - m_smartPaste = false; - } -} - -void KMLineEdit::smartInsert( const QString &str, int pos /* = -1 */ ) -{ - QString newText = str.stripWhiteSpace(); - if (newText.isEmpty()) - return; - - // remove newlines in the to-be-pasted string: - newText.replace( QRegExp("\r?\n"), " " ); - - QString contents = text(); - // determine the position where to insert the to-be-pasted string - if( ( pos < 0 ) || ( pos > (int) contents.length() ) ) - pos = contents.length(); - int start_sel = 0; - int end_sel = 0; - if (getSelection(&start_sel, &end_sel)) - { - // Cut away the selection. - if (pos > end_sel) - pos -= (end_sel - start_sel); - else if (pos > start_sel) - pos = start_sel; - contents = contents.left(start_sel) + contents.right(end_sel+1); - } - - int eot = contents.length(); - // remove trailing whitespace from the contents of the line edit - while ((eot > 0) && contents[eot-1].isSpace()) eot--; - if (eot == 0) - { - contents = QString::null; - } - else if (pos >= eot) - { - if (contents[eot-1] == ',') - eot--; - contents.truncate(eot); - contents += ", "; - pos = eot+2; - } - - if (newText.startsWith("mailto:")) - { - kdDebug(5006) << "Pasting '" << newText << "'" << endl; - KURL u(newText); - newText = u.path(); - kdDebug(5006) << "path of mailto URL: '" << newText << "'" << endl; - // Is the mailto URL RFC 2047 encoded (cf. RFC 2368)? - if (-1 != newText.find( QRegExp("=\\?.*\\?[bq]\\?.*\\?=") ) ) - newText = KMMsgBase::decodeRFC2047String( newText.latin1() ); - } - else if (-1 != newText.find(" at ")) - { - // Anti-spam stuff - newText.replace( " at ", "@" ); - newText.replace( " dot ", "." ); - } - else if (newText.contains("(at)")) - { - newText.replace( QRegExp("\\s*\\(at\\)\\s*"), "@" ); - } - contents = contents.left(pos)+newText+contents.mid(pos); - setText(contents); - setEdited( true ); - setCursorPosition(pos+newText.length()); -} -#endif //----------------------------------------------------------------------------- void KMLineEdit::loadContacts() diff --git a/kmcomposewin.h b/kmcomposewin.h index 449ed07f3..bc4ba2d55 100644 --- a/kmcomposewin.h +++ b/kmcomposewin.h @@ -188,19 +188,6 @@ public: protected: // Inherited. Always called by the parent when this widget is created. virtual void loadContacts(); - /** - * Smart insertion of email addresses. If @p pos is -1 then - * @p str is inserted at the end of the current contents of this - * lineedit. Else @p str is inserted at @p pos. - * Features: - * - Automatically adds ',' if necessary to separate email addresses - * - Correctly decodes mailto URLs - * - Recognizes email addresses which are protected against address - * harvesters, i.e. "name at kde dot org" and "name(at)kde.org" - - void smartInsert( const QString &str, int pos = -1 ); - virtual void dropEvent(QDropEvent *e); -*/ virtual void keyPressEvent(QKeyEvent*);