[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi
From:       Jarosław Staniek <staniek () kde ! org>
Date:       2010-09-03 22:34:05
Message-ID: 20100903223405.8A2D5AC884 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1171471 by staniek:

Main Window
*Object tabs
**now movable
**contain only names/captions of objects (this is shorter)
**have tooltip and "what's this" information
**have context menu with "Close Tab" action



 M  +1 -1      core/KexiWindow.cpp  
 M  +27 -5     main/KexiMainWindow.cpp  
 M  +4 -0      main/KexiMainWindow.h  


--- trunk/koffice/kexi/core/KexiWindow.cpp #1171470:1171471
@@ -815,7 +815,7 @@
 {
     if (!d->item || !d->part)
         return;
-    QString fullCapt(KexiPart::fullCaptionForItem(*d->item, d->part));
+    QString fullCapt(d->item->captionOrName());
     setWindowTitle(fullCapt + (isDirty() ? "*" : ""));
 }
 
--- trunk/koffice/kexi/main/KexiMainWindow.cpp #1171470:1171471
@@ -181,14 +181,19 @@
         : KTabWidget(parent)
         , m_mainWidget(mainWidget)
 {
+    m_closeAction = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
+    m_closeAction->setToolTip(i18n("Close the current tab"));
+    m_closeAction->setWhatsThis(i18n("Closes the current tab."));
+    connect(m_closeAction, SIGNAL(triggered()), this, SLOT(closeTab()));
     // close-tab button:
     QToolButton* rightWidget = new QToolButton(this);
-    connect(rightWidget, SIGNAL(clicked()), this, SLOT(closeTab()));
-    rightWidget->setIcon(KIcon("tab-close"));
+    rightWidget->setDefaultAction(m_closeAction);
+    rightWidget->setText(QString());
     rightWidget->setAutoRaise(true);
     rightWidget->adjustSize();
-    rightWidget->setToolTip(i18n("Close the current tab"));
     setCornerWidget(rightWidget, Qt::TopRightCorner);
+    setMovable(true);
+    tabBar()->setExpanding(true);
 }
 
 KexiMainWindowTabWidget::~KexiMainWindowTabWidget()
@@ -214,6 +219,15 @@
     m_mainWidget->slotCurrentTabIndexChanged(index);
 }
 
+void KexiMainWindowTabWidget::contextMenu(int index, const QPoint& point)
+{
+    QMenu menu;
+    menu.addAction(m_closeAction);
+//! @todo add "&Detach Tab"
+    menu.exec(point);
+    KTabWidget::contextMenu(index, point);
+}
+    
 //-------------------------------------------------
 
 //static
@@ -856,6 +870,8 @@
     ac->addAction("edit_find",
                   d->action_edit_find = KStandardAction::find(
                                             this, SLOT(slotEditFind()), this));
+    d->action_edit_find->setToolTip(i18n("Find text"));
+    d->action_edit_find->setWhatsThis(i18n("Looks up the first occurence of a piece \
of text."));  // d->action_edit_find = createSharedAction( KStandardAction::Find, \
"edit_find");  ac->addAction("edit_findnext",
                   d->action_edit_findnext = KStandardAction::findNext(
@@ -4188,8 +4204,14 @@
 
         // open new tab earlier
         windowContainer = new KexiWindowContainer(d->mainWidget->tabWidget());
-        d->mainWidget->tabWidget()->addTab(windowContainer,
-                                           KIcon(part ? part->info()->itemIcon() : \
QString()), KexiPart::fullCaptionForItem(*item, part)); +        const int tabIndex = \
d->mainWidget->tabWidget()->addTab( +            windowContainer,
+            KIcon(part ? part->info()->itemIcon() : QString()),
+            item->captionOrName());
+        d->mainWidget->tabWidget()->setTabToolTip(tabIndex, \
KexiPart::fullCaptionForItem(*item, part)); +        \
d->mainWidget->tabWidget()->setTabWhatsThis( +            tabIndex,
+            i18n("Tab for \"%1\" (%2).", item->captionOrName(), \
part->instanceCaption()));  \
d->mainWidget->tabWidget()->setCurrentWidget(windowContainer);  
 #ifndef KEXI_NO_PENDING_DIALOGS
--- trunk/koffice/kexi/main/KexiMainWindow.h #1171470:1171471
@@ -61,6 +61,9 @@
 public slots:
     void closeTab();
 protected:
+    //! Implemented to add context menu
+    void contextMenu(int index, const QPoint& point);
+
     //! Implemented to update main window on creation of the first tab
     virtual void tabInserted(int index);
 
@@ -68,6 +71,7 @@
     virtual void paintEvent(QPaintEvent * event);
 
     KexiMainWidget *m_mainWidget;
+    KAction *m_closeAction;
 };
 
 #define KexiMainWindowSuper QWidget //KMainWindow


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic