|
From: <vz...@us...> - 2008-03-04 23:29:28
|
Revision: 46
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=46&view=rev
Author: vzsolt
Date: 2008-03-04 15:29:33 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
I've removed KActionMap as we've discussed.
Modified Paths:
--------------
trunk/src/CMakeLists.txt
trunk/src/mainwindow.cpp
Removed Paths:
-------------
trunk/src/kactionmap.cpp
trunk/src/kactionmap.h
Modified: trunk/src/CMakeLists.txt
===================================================================
--- trunk/src/CMakeLists.txt 2008-03-04 20:34:48 UTC (rev 45)
+++ trunk/src/CMakeLists.txt 2008-03-04 23:29:33 UTC (rev 46)
@@ -27,7 +27,6 @@
gnubarcode.cpp
gnubarkodeengine.cpp
imageitem.cpp
- kactionmap.cpp
kbarcode.cpp
kbarcodesettings.cpp
label.cpp
Deleted: trunk/src/kactionmap.cpp
===================================================================
--- trunk/src/kactionmap.cpp 2008-03-04 20:34:48 UTC (rev 45)
+++ trunk/src/kactionmap.cpp 2008-03-04 23:29:33 UTC (rev 46)
@@ -1,190 +0,0 @@
-/***************************************************************************
- kactionmap.cpp - description
- -------------------
- begin : Fri Mai 19 2006
- copyright : (C) 2006 by Dominik Seichter
- email : dom...@we...
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#include "kactionmap.h"
-
-#include <qimage.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qmenubar.h>
-#include <qmenudata.h>
-#include <qpixmap.h>
-#include <q3popupmenu.h>
-#include <qregexp.h>
-#include <q3vbox.h>
-//Added by qt3to4:
-#include <QVBoxLayout>
-
-#include <kaction.h>
-#include <kapplication.h>
-#include <k3listview.h>
-#if KDE_VERSION >= 0x030500
-#include <k3listviewsearchline.h>
-#endif
-#include <klocale.h>
-
-class KListViewActionItem : public KListViewItem {
-public:
- KListViewActionItem( KListView* parent, KAction* action )
- : KListViewItem( parent ), m_action( action )
- {
- QPixmap pix;
- QSize size = QIcon::iconSize( QIcon::Large );
- QIcon iconset = m_action->iconSet( KIconLoader::Panel, KIconLoader::SizeLarge );
- QRegExp regtag( "<[^>]*>" );
-
- pix = iconset.pixmap( QIcon::Large, QIcon::Normal ); // m_action->isEnabled() ? QIconSet::Normal : QIconSet::Disabled );
- if( pix.isNull() )
- {
- pix.resize( size );
- pix.fill( backgroundColor() );
- }
- else
- {
- if( pix.size() != size )
- {
- pix = pix.convertToImage().smoothScale( size );
- }
- }
-
- setText( 0, m_action->plainText() );
- setText( 1, m_action->shortcutText() );
- // replace HTML tags in What's this help
- setText( 2, m_action->whatsThis().replace( regtag, "" ) );
- setPixmap( 0, pix );
- }
-
- void paintCell( QPainter *p, const QColorGroup &cg,
- int column, int width, int alignment )
- {
- QColorGroup _cg( cg );
- QColor c = _cg.text();
- if( m_action && !m_action->isEnabled() )
- _cg.setColor( QColorGroup::Text, Qt::gray );
-
- KListViewItem::paintCell( p, _cg, column, width, alignment );
- _cg.setColor( QColorGroup::Text, c );
- }
-
- inline KAction* action() const
- {
- return m_action;
- }
-
-private:
- KAction* m_action;
-};
-
-KActionMapDlg::KActionMapDlg( KActionCollection* actions, QWidget* parent )
- : KDialogBase( parent, false, i18n("Action Map"), KDialogBase::Close, KDialogBase::Close )
-{
- KVBox *page = makeVBoxMainWidget();
-
- new QLabel( i18n("Find and execute actions."), page );
- m_map = new KActionMap( actions, page );
-
- show();
-}
-
-void KActionMapDlg::updateEnabledState()
-{
- m_map->updateEnabledState();
-}
-
-KActionMap::KActionMap( KActionCollection* actions, QWidget* parent )
- : QWidget( parent ), m_actions( actions ), m_showMenuTree( true ), m_grayOutItems( false )
-{
- QVBoxLayout* layout = new QVBoxLayout( this );
-
- m_listView = new KListView( this );
-#if KDE_VERSION >= 0x030500
- m_searchLine = new KListViewSearchLineWidget( m_listView, this );
-#endif
-
- m_listView->addColumn( i18n("Action") );
- m_listView->addColumn( i18n("Shortcut") );
- m_listView->addColumn( i18n("Description") );
- m_listView->setColumnWidthMode( 0, QListView::Maximum );
- m_listView->setColumnWidthMode( 1, QListView::Maximum );
- m_listView->setColumnWidthMode( 2, QListView::Manual );
- m_listView->setSorting( 0 );
- m_listView->setAllColumnsShowFocus( true );
-
-#if KDE_VERSION >= 0x030500
- layout->addWidget( m_searchLine );
-#endif
- layout->addWidget( m_listView );
-
- connect( m_listView, SIGNAL( executed( QListViewItem* ) ), this, SLOT( slotExecuteAction( QListViewItem* ) ) );
- connect( actions, SIGNAL( inserted( KAction* ) ), this, SLOT( slotActionCollectionChanged() ) );
- connect( actions, SIGNAL( removed( KAction* ) ), this, SLOT( slotActionCollectionChanged() ) );
- slotActionCollectionChanged();
-}
-
-KActionMap::~KActionMap()
-{
-
-}
-
-void KActionMap::slotActionCollectionChanged()
-{
- KActionPtrList actions;
- KActionPtrList::const_iterator it;
-
- m_listView->clear();
-
- if( !m_actions )
- return;
-
- actions = m_actions->actions();
- it = actions.begin();
-
- while( it != actions.end() )
- {
- /*
- if( m_showMenuTree )
- {
- }
- */
-
- new KListViewActionItem( m_listView, (*it) );
-
- connect( *it, SIGNAL( enabled(bool) ), this, SLOT( updateEnabledState() ) );
-
- ++it;
- }
-
-}
-
-void KActionMap::slotExecuteAction( QListViewItem* item )
-{
- KListViewActionItem* action = dynamic_cast<KListViewActionItem*>(item);
- if( !action )
- return;
-
- if( !action->action()->isEnabled() )
- return;
-
- action->action()->activate();
-}
-
-void KActionMap::updateEnabledState()
-{
- m_listView->repaintContents();
-}
-
-#include "kactionmap.moc"
Deleted: trunk/src/kactionmap.h
===================================================================
--- trunk/src/kactionmap.h 2008-03-04 20:34:48 UTC (rev 45)
+++ trunk/src/kactionmap.h 2008-03-04 23:29:33 UTC (rev 46)
@@ -1,101 +0,0 @@
-/***************************************************************************
- kactionmap.h - description
- -------------------
- begin : Fri Mai 19 2006
- copyright : (C) 2006 by Dominik Seichter
- email : dom...@we...
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-#ifndef _KACTION_MAP_H_
-#define _KACTION_MAP_H_
-
-#include <qwidget.h>
-#include <kdeversion.h>
-#include <kdialogbase.h>
-
-class KActionCollection;
-class KActionMap;
-#if KDE_VERSION >= 0x030500
-class KListViewSearchLineWidget;
-#endif
-class KListView;
-class QListViewItem;
-
-/** Open a simple dialog containing an action map.
- */
-class KActionMapDlg : public KDialogBase {
- public:
- KActionMapDlg( KActionCollection* actions, QWidget* parent = NULL );
-
- /** Call this function whenever you changed the enabled/disalbed state of an action
- * in your application.
- */
- void updateEnabledState();
-
- private:
- KActionMap* m_map;
-};
-
-/**
- *
- * This class is an implementation of an Action Map for KDE.
- *
- *
- * What is an Action Map?
- *
- * Almost every web page has a site map. According to Wikipedia,
- * a site map "helps visitors, and search engine robots, to find
- * pages on the site". Similar an Action Map should help the
- * user to find actions (i.e. functions or menu items) in an application.
- *
- * More concrete an Action Map is a dialog with a list of all
- * actions (i.e. make text bold, save file or insert image)
- * that can be performed in the application at its current state.
- * Additionally there is a search box at the top of the list so
- * that the user can search the list easily for a special action.
- * The action is executed by clicking on it. Disabled actions are
- * grayed out and cannot be clicked. The dialog is modeless so that
- * it can always be open and the normal usage of the application is not disturbed.
- */
-class KActionMap : public QWidget {
- Q_OBJECT
- public:
- /** Creates a new KActionMap widget
- * @param action all actions from this KActionCollection are displayed.
- * @param parent the parent
- * @param name the name
- */
- KActionMap( KActionCollection* actions, QWidget* parent = NULL );
- ~KActionMap();
-
- public slots:
- /** Call this function whenever you changed the enabled/disalbed state of an action
- * in your application.
- */
- void updateEnabledState();
-
- private slots:
- void slotActionCollectionChanged();
- void slotExecuteAction( QListViewItem* item );
-
- private:
- KActionCollection* m_actions;
- KListView* m_listView;
-#if KDE_VERSION >= 0x030500
- KListViewSearchLineWidget* m_searchLine;
-#endif
-
- bool m_showMenuTree;
- bool m_grayOutItems;
-};
-
-#endif // _KACTION_MAP_H_
Modified: trunk/src/mainwindow.cpp
===================================================================
--- trunk/src/mainwindow.cpp 2008-03-04 20:34:48 UTC (rev 45)
+++ trunk/src/mainwindow.cpp 2008-03-04 23:29:33 UTC (rev 46)
@@ -14,7 +14,6 @@
#include "confwizard.h"
#include "printersettings.h"
#include "kbarcodesettings.h"
-// #include "kactionmap.h" - is it neccessary?
#include "barkode.h"
// Qt includes
@@ -263,12 +262,4 @@
return text;
}
-// TODO: Do something about action maps, after porting to the new KAction API
-/*
-void MainWindow::slotFunctionMap()
-{
- new KActionMapDlg( actionCollection(), this );
-}
-*/
-
#include "mainwindow.moc"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|