|
|
|
|
@ -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() |
|
|
|
|
|