From kde-commits Fri Aug 05 11:39:16 2005 From: Peter Rockai Date: Fri, 05 Aug 2005 11:39:16 +0000 To: kde-commits Subject: playground/sysadmin/ept Message-Id: <1123241956.039581.4653.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112324207630999 SVN commit 443214 by mornfall: Merge from nevrast: r375@nevrast: mornfall | 2005-08-05 13:14:57 +0200 Add Quit action. We now actually have features kynaptic doesn't ;-). r374@nevrast: mornfall | 2005-08-05 13:14:25 +0200 Improved the lister tooltip. _M trunk/playground/sysadmin/ept (directory) M +36 -11 libept/lister.cpp M +2 -0 libept/lister.h M +2 -0 testing-ui/app.cpp M +2 -2 testing-ui/ept-testing-uiui.rc ** trunk/playground/sysadmin/ept #property changes Name: svk:merge + e5ad508d-cdfc-0310-88ec-f8945a0f1aa7:/trunk/playground/sysadmin/ept:1764 --- trunk/playground/sysadmin/ept/libept/lister.cpp #443213:443214 @@ -137,6 +137,42 @@ return "undef!"; } +QString ListerTooltip::format( const QString &what, const QString &txt, bool nobr ) +{ + QString ret = "" + what + " " + (nobr ? "" : "") + + txt + (nobr ? "" : "") + "
"; + return ret; +} + +void ListerTooltip::maybeTip (const QPoint &pt) +{ + if (! m_parent) + return; + kdDebug() << "ListTreeWidgetTooltip::maybeTip ()" << endl; + ListerItem *x = dynamic_cast( m_parent->itemAt( pt ) ); + if (! x) + return; + QString str = ""; + QString descr, cand, cur; + descr = cand = cur = "Not available"; + entity::Package p( x->entity() ); + try { + descr = p.shortDescription(); + } catch (...) {} + try { + cand = p.candidateVersion().versionString(); + } catch (...) {} + try { + cur = p.currentVersion().versionString(); + } catch (...) {} + str += format( "Package:", p.name() ); + str += format( "Description:", descr ); + str += format( "Current Version:", cur ); + str += format( "Candidate Version:", cand ); + str.append (""); + tip( m_parent->itemRect( x ), str ); +} + #if 0 void ListTreeWidget::forwardSelectionChanged (QListViewItem *i) { @@ -178,17 +214,6 @@ m_actor -> executeAction (m_actions [i]); } -void ListTreeWidgetTooltip::maybeTip (const QPoint &p) -{ - if (! m_parent) - return; - // std::cerr << "ListTreeWidgetTooltip::maybeTip ()" << std::endl; - KListViewItemCustom *i = dynamic_cast (m_parent-> - itemAt (p)); - /* XXX if (i) - tip (m_parent -> itemRect (i), TreeView::cElemTooltip (**(i -> m_treeNode))); */ -} #endif -void ListerTooltip::maybeTip (const QPoint &p) {} #include "lister.moc" --- trunk/playground/sysadmin/ept/libept/lister.h #443213:443214 @@ -69,6 +69,7 @@ ListerTooltip (QWidget *v, Lister *p) : QToolTip (v, 0), m_parent (p) {}; protected: virtual void maybeTip (const QPoint &p); + QString format( const QString &, const QString &, bool = true ); Lister *m_parent; }; @@ -83,6 +84,7 @@ {} virtual ~ListerItem() {} virtual QString text( int column ) const; + entity::Entity entity() { return m_item; } protected: entity::Entity m_item; }; --- trunk/playground/sysadmin/ept/testing-ui/app.cpp #443213:443214 @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,7 @@ new KAction( i18n( "Update Cache" ), "cache_update", 0, this, SLOT( cacheUpdate() ), actionCollection(), "cache_update" ); + KStdAction::quit( kapp, SLOT( quit() ), actionCollection() ); } void TestApp::cacheUpdate() { --- trunk/playground/sysadmin/ept/testing-ui/ept-testing-uiui.rc #443213:443214 @@ -1,8 +1,8 @@ - -&Cache + +&Ept