akonadi/contact
21 #include "textbrowser_p.h"
22 #include <kicontheme.h>
23 #include <ktextbrowser.h>
24 #include <klocalizedstring.h>
28 #include <kmime/kmime_util.h>
31 #include <QApplication>
32 #include <QContextMenuEvent>
36 using namespace Akonadi;
38 TextBrowser::TextBrowser( QWidget *parent )
39 : KTextBrowser( parent )
43 void TextBrowser::slotCopyEmail()
45 #ifndef QT_NO_CLIPBOARD
46 QClipboard* clip = QApplication::clipboard();
48 const QString address = KMime::decodeRFC2047String( KUrl(mLinkToCopy).path().toUtf8() );
49 clip->setText( address, QClipboard::Clipboard );
50 clip->setText( address, QClipboard::Selection );
54 #ifndef QT_NO_CONTEXTMENU
55 void TextBrowser::contextMenuEvent( QContextMenuEvent *event )
57 QMenu *popup = createStandardContextMenu( event->pos() );
59 QList<QAction*> actions = popup->actions();
62 KIconTheme::assignIconsToContextMenu( KIconTheme::ReadOnlyText, actions );
63 #ifndef QT_NO_CLIPBOARD
65 mLinkToCopy = anchorAt( event->pos() );
66 if ( mLinkToCopy.left( 7 ) != QLatin1String(
"mailto:" ) ) {
67 actions[ 1 ]->setVisible(
false );
69 actions[ 1 ]->setText( i18n(
"Copy e-mail address" ) );
70 disconnect(actions[1]);
71 connect(actions[1],SIGNAL(triggered(
bool)),
this,SLOT(slotCopyEmail()));
74 popup->exec( event->globalPos() );
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:03:48 by
doxygen 1.8.5 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.