[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/akregator/src
From: Teemu Rytilahti <teemu.rytilahti () kde-fi ! org>
Date: 2004-05-31 21:21:37
Message-ID: 20040531212137.CD3B9126C7 () office ! kde ! org
[Download RAW message or body]
CVS commit by rytilahti:
Oops, Cervisia commited stuff only from the current directory, sorry about that.
So, here's the code...
M +2 -1 akregator_view.cpp 1.80
M +3 -3 akregator_view.h 1.35
M +42 -5 tabwidget.cpp 1.2
M +6 -1 tabwidget.h 1.2
--- kdenonbeta/akregator/src/akregator_view.cpp #1.79:1.80
@@ -189,5 +190,5 @@ void aKregatorView::slotOpenTab(const KU
page->openURL(url);
- m_tabs->addTab(page->widget(), "Untitled");
+ m_tabs->addTab(page->widget(), i18n("Untitled"));
m_tabs->showPage(page->widget());
if (m_tabs->count() > 1)
--- kdenonbeta/akregator/src/tabwidget.cpp #1.1:1.2
@@ -10,8 +10,15 @@
#include <qstyle.h>
#include <qapplication.h>
+#include <qiconset.h>
#include <kdebug.h>
#include <ktabwidget.h>
#include <ktabbar.h>
+#include <kpopupmenu.h>
+#include <krun.h>
+#include <klocale.h>
+#include <khtmlview.h>
+#include <khtml_part.h>
+#include <kiconloader.h>
using namespace Akregator;
@@ -120,3 +127,33 @@ void TabWidget::setTitle( const QString
}
+void TabWidget::contextMenu(int i, const QPoint &p)
+{
+ currentItem = page(i);
+ KPopupMenu popup;
+ //popup.insertTitle(tabLabel(currentItem));
+ int detachTab = popup.insertItem( SmallIcon("tab_breakoff"), i18n("Detach Tab"), \
this, SLOT( slotDetachTab() ) ); + //popup.insertSeparator();
+ int closeTab = popup.insertItem( SmallIcon("tab_remove"), i18n("Close Tab"), \
this, SLOT( slotCloseTab() ) ); + if(indexOf(currentItem) == 0) { // you can't \
detach or close articles tab.. + popup.setItemEnabled(detachTab, false);
+ popup.setItemEnabled(closeTab, false);
+ }
+ popup.exec(p);
+}
+
+void TabWidget::slotDetachTab()
+{
+ if(!currentItem) return;
+ KURL url;
+ if (KHTMLView *view = dynamic_cast<KHTMLView*>(currentItem)) url = \
view->part()->url(); + else return;
+ KRun::runURL(url.prettyURL(),"text/html", false, false);
+ removePage(currentItem);
+}
+
+void TabWidget::slotCloseTab()
+{
+ if(!currentItem) return;
+ removePage(currentItem);
+}
#include "tabwidget.moc"
--- kdenonbeta/akregator/src/tabwidget.h #1.1:1.2
@@ -27,4 +27,9 @@ namespace Akregator
QDict <QWidget>m_titleDict;
unsigned int m_CurrentMaxLength;
+ QWidget *currentItem;
+ private slots:
+ void slotDetachTab();
+ void slotCloseTab();
+ void contextMenu (int item, const QPoint &p);
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic