From 89df3e0ae32cc14ed971b30b7c2a4a6e1cd5f9e9 Mon Sep 17 00:00:00 2001 From: ikemo Date: Wed, 29 Sep 2004 16:41:16 +0000 Subject: [PATCH] refactoring. git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1410 56b19765-1e22-0410-a548-a0f45d66c51a --- kita/src/kitasubjectview.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/kita/src/kitasubjectview.cpp b/kita/src/kitasubjectview.cpp index 8e720a1..73bdf23 100644 --- a/kita/src/kitasubjectview.cpp +++ b/kita/src/kitasubjectview.cpp @@ -291,6 +291,14 @@ void KitaSubjectView::slotUpdateSubject( const KURL& url ) void KitaSubjectView::slotContextMenuRequested( QListViewItem* item, const QPoint& point, int ) { + enum { + Menu_OpenWithBrowser, + Menu_OpenWithNewTab, + Menu_CopyTitleAndURL, + Menu_Favorites, + Menu_DeleteLog + }; + if ( item == 0 ) { return ; } @@ -299,37 +307,37 @@ void KitaSubjectView::slotContextMenuRequested( QListViewItem* item, const QPoin bool isFavorites = FavoriteThreads::getInstance()->contains( thread->datURL() ); KPopupMenu popup( 0 ); - popup.insertItem( i18n( "Open with Web Browser" ), 0 ); - popup.insertItem( i18n( "Open with new tab" ), 1 ); - popup.insertItem( i18n( "Copy title and URL" ), 2 ); + popup.insertItem( i18n( "Open with Web Browser" ), Menu_OpenWithBrowser ); + popup.insertItem( i18n( "Open with new tab" ), Menu_OpenWithNewTab ); + popup.insertItem( i18n( "Copy title and URL" ), Menu_CopyTitleAndURL ); if ( isFavorites ) { - popup.insertItem( i18n( "Remove from Favorites" ), 3 ); + popup.insertItem( i18n( "Remove from Favorites" ), Menu_Favorites ); } else { - popup.insertItem( i18n( "Add to Favorites" ), 3 ); + popup.insertItem( i18n( "Add to Favorites" ), Menu_Favorites ); } popup.insertSeparator(); - popup.insertItem( i18n( "Delete Log" ), 4 ); - + popup.insertItem( i18n( "Delete Log" ), Menu_DeleteLog ); + QClipboard* clipboard = QApplication::clipboard(); switch ( popup.exec( point ) ) { - case 0: + case Menu_OpenWithBrowser: KRun::runURL( thread->url(), "text/html" ); break; - case 1: + case Menu_OpenWithNewTab: emit showThreadRequested( thread->datURL(), true ); break; - case 2: + case Menu_CopyTitleAndURL: clipboard->setText( thread->name() + "\n" + thread->url() ); break; - case 3: + case Menu_Favorites: if ( isFavorites ) { emit bookmarked( thread->datURL(), false ); } else { emit bookmarked( thread->datURL(), true ); } break; - case 4: + case Menu_DeleteLog: deleteLog( Kita::DatManager::threadURL( thread->datURL() ) ); break; default: -- 2.11.0