Diffstat (limited to 'microkde/kdeui/ktoolbarhandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/ktoolbarhandler.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/microkde/kdeui/ktoolbarhandler.cpp b/microkde/kdeui/ktoolbarhandler.cpp index 7b97233..4d3ace7 100644 --- a/microkde/kdeui/ktoolbarhandler.cpp +++ b/microkde/kdeui/ktoolbarhandler.cpp | |||
@@ -15,13 +15,15 @@ | |||
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "ktoolbarhandler.h" | 19 | #include "ktoolbarhandler.h" |
20 | 20 | ||
21 | #include <qpopupmenu.h> | 21 | #include <q3popupmenu.h> |
22 | //Added by qt3to4: | ||
23 | #include <Q3PtrList> | ||
22 | #include <kapplication.h> | 24 | #include <kapplication.h> |
23 | #include <ktoolbar.h> | 25 | #include <ktoolbar.h> |
24 | #include <kmainwindow.h> | 26 | #include <kmainwindow.h> |
25 | #include <klocale.h> | 27 | #include <klocale.h> |
26 | #include <kaction.h> | 28 | #include <kaction.h> |
27 | #include <assert.h> | 29 | #include <assert.h> |
@@ -41,13 +43,13 @@ namespace | |||
41 | 43 | ||
42 | const char *resourceFileName = "barhandler.rc"; | 44 | const char *resourceFileName = "barhandler.rc"; |
43 | 45 | ||
44 | class BarActionBuilder | 46 | class BarActionBuilder |
45 | { | 47 | { |
46 | public: | 48 | public: |
47 | BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, QPtrList<KToolBar> &oldToolBarList ) | 49 | BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, Q3PtrList<KToolBar> &oldToolBarList ) |
48 | : m_actionCollection( actionCollection ), m_mainWindow( mainWindow ), m_needsRebuild( false ) | 50 | : m_actionCollection( actionCollection ), m_mainWindow( mainWindow ), m_needsRebuild( false ) |
49 | { | 51 | { |
50 | /*US | 52 | /*US |
51 | QPtrList<QDockWindow> dockWindows = m_mainWindow->dockWindows(); | 53 | QPtrList<QDockWindow> dockWindows = m_mainWindow->dockWindows(); |
52 | QPtrListIterator<QDockWindow> dockWindowIt( dockWindows ); | 54 | QPtrListIterator<QDockWindow> dockWindowIt( dockWindows ); |
53 | for ( ; dockWindowIt.current(); ++dockWindowIt ) { | 55 | for ( ; dockWindowIt.current(); ++dockWindowIt ) { |
@@ -67,42 +69,42 @@ namespace | |||
67 | m_needsRebuild = ( oldToolBarList.count() != m_toolBars.count() ); | 69 | m_needsRebuild = ( oldToolBarList.count() != m_toolBars.count() ); |
68 | 70 | ||
69 | } | 71 | } |
70 | 72 | ||
71 | bool needsRebuild() const { return m_needsRebuild; } | 73 | bool needsRebuild() const { return m_needsRebuild; } |
72 | 74 | ||
73 | QPtrList<KAction> create() | 75 | Q3PtrList<KAction> create() |
74 | { | 76 | { |
75 | if ( !m_needsRebuild ) | 77 | if ( !m_needsRebuild ) |
76 | return QPtrList<KAction>(); | 78 | return Q3PtrList<KAction>(); |
77 | 79 | ||
78 | QPtrListIterator<KToolBar> toolBarIt( m_toolBars ); | 80 | Q3PtrListIterator<KToolBar> toolBarIt( m_toolBars ); |
79 | for ( ; toolBarIt.current(); ++toolBarIt ) | 81 | for ( ; toolBarIt.current(); ++toolBarIt ) |
80 | handleToolBar( toolBarIt.current() ); | 82 | handleToolBar( toolBarIt.current() ); |
81 | 83 | ||
82 | QPtrList<KAction> actions; | 84 | Q3PtrList<KAction> actions; |
83 | 85 | ||
84 | if ( m_toolBarActions.count() == 0 ) | 86 | if ( m_toolBarActions.count() == 0 ) |
85 | return actions; | 87 | return actions; |
86 | 88 | ||
87 | if ( m_toolBarActions.count() == 1 ) { | 89 | if ( m_toolBarActions.count() == 1 ) { |
88 | m_toolBarActions.getFirst()->setText( i18n( "Show Toolbar" ) ); | 90 | m_toolBarActions.getFirst()->setText( i18n( "Show Toolbar" ) ); |
89 | return m_toolBarActions; | 91 | return m_toolBarActions; |
90 | } | 92 | } |
91 | 93 | ||
92 | KActionMenu *menuAction = new KActionMenu( i18n( "Toolbars" ), m_actionCollection, "toolbars_submenu_action" ); | 94 | KActionMenu *menuAction = new KActionMenu( i18n( "Toolbars" ), m_actionCollection, "toolbars_submenu_action" ); |
93 | 95 | ||
94 | QPtrListIterator<KAction> actionIt( m_toolBarActions ); | 96 | Q3PtrListIterator<KAction> actionIt( m_toolBarActions ); |
95 | for ( ; actionIt.current(); ++actionIt ) | 97 | for ( ; actionIt.current(); ++actionIt ) |
96 | menuAction->insert( actionIt.current() ); | 98 | menuAction->insert( actionIt.current() ); |
97 | 99 | ||
98 | actions.append( menuAction ); | 100 | actions.append( menuAction ); |
99 | return actions; | 101 | return actions; |
100 | } | 102 | } |
101 | 103 | ||
102 | const QPtrList<KToolBar> &toolBars() const { return m_toolBars; } | 104 | const Q3PtrList<KToolBar> &toolBars() const { return m_toolBars; } |
103 | 105 | ||
104 | private: | 106 | private: |
105 | void handleToolBar( KToolBar *toolBar ) | 107 | void handleToolBar( KToolBar *toolBar ) |
106 | { | 108 | { |
107 | KAction *action = new KToggleToolBarAction( toolBar, | 109 | KAction *action = new KToggleToolBarAction( toolBar, |
108 | i18n( "Show %1" ).arg( toolBar->label() ), | 110 | i18n( "Show %1" ).arg( toolBar->label() ), |
@@ -112,14 +114,14 @@ namespace | |||
112 | m_toolBarActions.append( action ); | 114 | m_toolBarActions.append( action ); |
113 | } | 115 | } |
114 | 116 | ||
115 | KActionCollection *m_actionCollection; | 117 | KActionCollection *m_actionCollection; |
116 | KMainWindow *m_mainWindow; | 118 | KMainWindow *m_mainWindow; |
117 | 119 | ||
118 | QPtrList<KToolBar> m_toolBars; | 120 | Q3PtrList<KToolBar> m_toolBars; |
119 | QPtrList<KAction> m_toolBarActions; | 121 | Q3PtrList<KAction> m_toolBarActions; |
120 | 122 | ||
121 | bool m_needsRebuild : 1; | 123 | bool m_needsRebuild : 1; |
122 | }; | 124 | }; |
123 | } | 125 | } |
124 | 126 | ||
125 | using namespace KDEPrivate; | 127 | using namespace KDEPrivate; |
@@ -221,13 +223,13 @@ void ToolBarHandler::init( KMainWindow *mainWindow ) | |||
221 | } | 223 | } |
222 | */ | 224 | */ |
223 | } | 225 | } |
224 | 226 | ||
225 | void ToolBarHandler::connectToActionContainers() | 227 | void ToolBarHandler::connectToActionContainers() |
226 | { | 228 | { |
227 | QPtrListIterator<KAction> actionIt( m_actions ); | 229 | Q3PtrListIterator<KAction> actionIt( m_actions ); |
228 | for ( ; actionIt.current(); ++actionIt ) | 230 | for ( ; actionIt.current(); ++actionIt ) |
229 | connectToActionContainer( actionIt.current() ); | 231 | connectToActionContainer( actionIt.current() ); |
230 | } | 232 | } |
231 | 233 | ||
232 | void ToolBarHandler::connectToActionContainer( KAction *action ) | 234 | void ToolBarHandler::connectToActionContainer( KAction *action ) |
233 | { | 235 | { |
@@ -236,13 +238,13 @@ void ToolBarHandler::connectToActionContainer( KAction *action ) | |||
236 | connectToActionContainer( action->container( i ) ); | 238 | connectToActionContainer( action->container( i ) ); |
237 | } | 239 | } |
238 | 240 | ||
239 | void ToolBarHandler::connectToActionContainer( QWidget *container ) | 241 | void ToolBarHandler::connectToActionContainer( QWidget *container ) |
240 | { | 242 | { |
241 | //US QPopupMenu *popupMenu = dynamic_cast<QPopupMenu *>( container ); | 243 | //US QPopupMenu *popupMenu = dynamic_cast<QPopupMenu *>( container ); |
242 | QPopupMenu *popupMenu = (QPopupMenu *)( container ); | 244 | Q3PopupMenu *popupMenu = (Q3PopupMenu *)( container ); |
243 | if ( !popupMenu ) | 245 | if ( !popupMenu ) |
244 | return; | 246 | return; |
245 | 247 | ||
246 | connect( popupMenu, SIGNAL( aboutToShow() ), | 248 | connect( popupMenu, SIGNAL( aboutToShow() ), |
247 | this, SLOT( setupActions() ) ); | 249 | this, SLOT( setupActions() ) ); |
248 | } | 250 | } |