1 /***************************************************************************
4 begin : Mon Feb 12 23:45:41 EST 2001
5 copyright : (C) 2001-2003 by Sarang Lakare
6 email : sarang#users.sourceforge.net
7 copyright : (C) 2003-2004 by Olaf Schmidt
8 email : ojschmidt@kde.org
9 ***************************************************************************/
11 /***************************************************************************
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
18 ***************************************************************************/
20 // include files for QT
25 #include <qclipboard.h>
26 #include <q3dragobject.h>
27 #include <q3whatsthis.h>
29 #include <q3popupmenu.h>
30 #include <kxmlguiclient.h>
32 #include <QContextMenuEvent>
34 #include <QDesktopWidget>
35 #include <kdeversion.h>
36 #include <kxmlguifactory.h>
38 // include files for KDE
40 #include <kapplication.h>
42 #include <kapplication.h>
45 #include <kkeydialog.h>
46 #include <kiconloader.h>
47 #include <kmessagebox.h>
48 #include <kfiledialog.h>
53 #include <kstdaction.h>
54 #include <khelpmenu.h>
57 #include <kio/netaccess.h>
58 #include <ktempfile.h>
60 #include <kedittoolbar.h>
69 // application specific includes
71 #include "kmagzoomview.h"
72 #include "kmagselrect.h"
75 #define havesetCheckedState
77 KmagApp::KmagApp(QWidget
* , const char* name
)
78 : KMainWindow(0, name
, Qt::WStyle_MinMax
| Qt::WType_TopLevel
| Qt::WDestructiveClose
| Qt::WStyle_ContextHelp
| Qt::WStyle_StaysOnTop
),
79 m_defaultMouseCursorType(2)
81 config
=KGlobal::config();
83 zoomArrayString
<< "5:1" << "2:1" << "1:1" << "1:1.5" << "1:2" << "1:3" << "1:4" << "1:5"
84 << "1:6" << "1:7" << "1:8" << "1:12" << "1:16" << "1:20";
86 // Is there a better way to initialize a vector array?
87 zoomArray
.push_back(0.2); zoomArray
.push_back(0.5); zoomArray
.push_back(1.0);
88 zoomArray
.push_back(1.5); zoomArray
.push_back(2.0); zoomArray
.push_back(3.0);
89 zoomArray
.push_back(4.0); zoomArray
.push_back(5.0); zoomArray
.push_back(6.0); zoomArray
.push_back(7.0);
90 zoomArray
.push_back(8.0); zoomArray
.push_back(12.0); zoomArray
.push_back(16.0); zoomArray
.push_back(20.0);
92 fpsArrayString
<< i18n("&Very Low") << i18n("&Low") << i18n("&Medium") << i18n("&High") << i18n("V&ery High");
94 fpsArray
.push_back(2); // very low
95 fpsArray
.push_back(6); // low
96 fpsArray
.push_back(10); // medium
97 fpsArray
.push_back(15); // high
98 fpsArray
.push_back(25); // very high
100 rotationArrayString
<< i18n("&No Rotation (0°)") << i18n("&Left (90°)") << i18n("&Upside Down (180°)") << i18n("&Right (270°)");
102 rotationArray
.push_back(0); // no rotation
103 rotationArray
.push_back(90); // left
104 rotationArray
.push_back(180); // upside down
105 rotationArray
.push_back(270); // right
107 // call inits to invoke all other construction parts
112 // read options from config file
115 // Register all KIO image formats - to be used when saving image.
116 KImageIO::registerFormats();
120 * Default destructor.
124 m_zoomView
->showSelRect(false);
127 void KmagApp::initActions()
129 fileNewWindow
= new KAction(i18n("New &Window"), "window_new", KStdAccel::openNew(), this,
130 SLOT(slotFileNewWindow()), actionCollection(),"new_window");
131 fileNewWindow
->setToolTip(i18n("Open a new KMagnifier window"));
133 refreshSwitch
= new KAction(i18n("&Stop"), "stop", KStdAccel::reload(), this,
134 SLOT(slotToggleRefresh()), actionCollection(), "start_stop_refresh");
135 refreshSwitch
->setToolTip(i18n("Click to stop window refresh"));
136 refreshSwitch
->setWhatsThis(i18n("Clicking on this icon will <b>start</b> / <b>stop</b>\
137 updating of the display. Stopping the update will zero the processing power\
138 required (CPU usage)"));
140 m_pSnapshot
= new KAction(i18n("&Save Snapshot As..."), "ksnapshot", KStdAccel::save(), this,
141 SLOT(saveZoomPixmap()), actionCollection(),"snapshot");
142 m_pSnapshot
->setWhatsThis(i18n("Saves the zoomed view to an image file."));
143 m_pSnapshot
->setToolTip(i18n("Save image to a file"));
145 m_pPrint
= KStdAction::print(this, SLOT(slotFilePrint()), actionCollection(), "print");
146 m_pPrint
->setWhatsThis(i18n("Click on this button to print the current zoomed view."));
148 m_pQuit
= KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection(), "quit");
149 m_pQuit
->setToolTip(i18n("Quits the application"));
150 m_pQuit
->setWhatsThis (i18n("Quits the application"));
152 m_pCopy
= KStdAction::copy(this, SLOT(copyToClipBoard()), actionCollection(), "copy");
153 m_pCopy
->setWhatsThis(i18n("Click on this button to copy the current zoomed view to the clipboard which you can paste in other applications."));
154 m_pCopy
->setToolTip(i18n("Copy zoomed image to clipboard"));
156 m_pShowMenu
= new KToggleAction(i18n("Show &Menu"), "showmenu", Qt::CTRL
+Qt::Key_M
, this,
157 SLOT(slotShowMenu()), actionCollection(),"show_menu");
158 #ifdef havesetCheckedState
159 m_pShowMenu
->setCheckedState(i18n("Hide &Menu"));
161 m_pShowMainToolBar
= new KToggleAction(i18n("Show Main &Toolbar"), 0, 0, this,
162 SLOT(slotShowMainToolBar()), actionCollection(),"show_mainToolBar");
163 #ifdef havesetCheckedState
164 m_pShowMainToolBar
->setCheckedState(i18n("Hide Main &Toolbar"));
166 m_pShowViewToolBar
= new KToggleAction(i18n("Show &View Toolbar"), 0, 0, this,
167 SLOT(slotShowViewToolBar()), actionCollection(),"show_viewToolBar");
168 #ifdef havesetCheckedState
169 m_pShowViewToolBar
->setCheckedState(i18n("Hide &View Toolbar"));
171 m_pShowSettingsToolBar
= new KToggleAction(i18n("Show &Settings Toolbar"), 0, 0, this,
172 SLOT(slotShowSettingsToolBar()), actionCollection(),"show_settingsToolBar");
173 #ifdef havesetCheckedState
174 m_pShowSettingsToolBar
->setCheckedState(i18n("Hide &Settings Toolbar"));
177 m_modeFollowMouse
= new KRadioAction(i18n("&Follow Mouse Mode"), "followmouse", Qt::Key_F1
, this,
178 SLOT(slotModeFollowMouse()), actionCollection(), "mode_followmouse");
179 m_modeFollowMouse
->setToolTip(i18n("Magnify around the mouse cursor"));
180 m_modeFollowMouse
->setWhatsThis(i18n("If selected, the area around the mouse cursor is magnified"));
182 m_modeSelWin
= new KRadioAction(i18n("Se&lection Window Mode"), "window", Qt::Key_F2
, this,
183 SLOT(slotModeSelWin()), actionCollection(), "mode_selectionwindow");
184 m_modeSelWin
->setToolTip(i18n("Show a window for selecting the magnified area"));
186 m_modeWholeScreen
= new KRadioAction(i18n("&Whole Screen Mode"), "window_fullscreen", Qt::Key_F3
, this,
187 SLOT(slotModeWholeScreen()), actionCollection(),"mode_wholescreen");
188 m_modeWholeScreen
->setToolTip(i18n("Magnify the whole screen"));
189 m_modeWholeScreen
->setWhatsThis(i18n("Click on this button to fit the zoom view to the zoom window."));
191 m_hideCursor
= new KToggleAction(i18n("Hide Mouse &Cursor"), "hidemouse", Qt::Key_F4
, this,
192 SLOT(slotToggleHideCursor()), actionCollection(), "hidecursor");
193 #ifdef havesetCheckedState
194 m_hideCursor
->setCheckedState(i18n("Show Mouse &Cursor"));
196 m_hideCursor
->setToolTip(i18n("Hide the mouse cursor"));
198 m_pZoomIn
= KStdAction::zoomIn(this, SLOT(zoomIn()), actionCollection(), "zoom_in");
199 m_pZoomIn
->setWhatsThis(i18n("Click on this button to <b>zoom-in</b> on the selected region."));
201 m_pZoomBox
= new KSelectAction(i18n("&Zoom"),0,actionCollection(),"zoom");
202 m_pZoomBox
->setItems(zoomArrayString
);
203 m_pZoomBox
->setWhatsThis(i18n("Select the zoom factor."));
204 m_pZoomBox
->setToolTip(i18n("Zoom factor"));
206 m_pZoomOut
= KStdAction::zoomOut(this, SLOT(zoomOut()), actionCollection(), "zoom_out");
207 m_pZoomOut
->setWhatsThis(i18n("Click on this button to <b>zoom-out</b> on the selected region."));
209 m_pRotationBox
= new KSelectAction(i18n("&Rotation"),0,actionCollection(),"rotation");
210 m_pRotationBox
->setItems(rotationArrayString
);
211 m_pRotationBox
->setWhatsThis(i18n("Select the rotation degree."));
212 m_pRotationBox
->setToolTip(i18n("Rotation degree"));
214 // KHelpMenu *newHelpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData());
216 m_keyConf
= KStdAction::keyBindings( this, SLOT( slotConfKeys() ), actionCollection(), "key_conf");
217 m_toolConf
= KStdAction::configureToolbars( this, SLOT( slotEditToolbars() ),
218 actionCollection(), "toolbar_conf");
220 m_pFPSBox
= new KSelectAction(i18n("&Refresh"),0,actionCollection(),"fps_selector");
221 m_pFPSBox
->setItems(fpsArrayString
);
222 m_pFPSBox
->setWhatsThis(i18n("Select the refresh rate. The higher the rate, the more computing power (CPU) will be needed."));
223 m_pFPSBox
->setToolTip(i18n("Refresh rate"));
228 void KmagApp::initView()
230 m_zoomView
= new KMagZoomView( this, "ZoomView" );
231 m_zoomView
->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType
)7, (QSizePolicy::SizeType
)7, m_zoomView
->sizePolicy().hasHeightForWidth() ) );
232 m_zoomView
->setFrameShape( QFrame::StyledPanel
);
233 m_zoomView
->setFrameShadow( QFrame::Raised
);
235 setCentralWidget(m_zoomView
);
239 * Initialize all connections.
241 void KmagApp::initConnections()
243 // change in zoom value -> update the view
244 connect(this, SIGNAL(updateZoomValue(float)), m_zoomView
, SLOT(setZoom(float)));
245 connect(this, SIGNAL(updateRotationValue(int)), m_zoomView
, SLOT(setRotation(int)));
246 connect(this, SIGNAL(updateFPSValue(float)), m_zoomView
, SLOT(setRefreshRate(float)));
248 // change in zoom index -> update the selector
249 connect(this, SIGNAL(updateZoomIndex(int)), m_pZoomBox
, SLOT(setCurrentItem(int)));
250 connect(this, SIGNAL(updateRotationIndex(int)), m_pRotationBox
, SLOT(setCurrentItem(int)));
251 connect(this, SIGNAL(updateFPSIndex(int)), m_pFPSBox
, SLOT(setCurrentItem(int)));
253 // selector selects a zoom index -> set the zoom index
254 connect(m_pZoomBox
, SIGNAL(activated(int)), this, SLOT(setZoomIndex(int)));
255 connect(m_pRotationBox
, SIGNAL(activated(int)), this, SLOT(setRotationIndex(int)));
256 connect(m_pFPSBox
, SIGNAL(activated(int)), this, SLOT(setFPSIndex(int)));
260 * Save options to config file.
262 void KmagApp::saveOptions()
264 config
->setGroup("General Options");
265 config
->writeEntry("Geometry", size());
266 config
->writeEntry("ZoomIndex", m_zoomIndex
);
267 config
->writeEntry("RotationIndex", m_rotationIndex
);
268 config
->writeEntry("FPSIndex", m_fpsIndex
);
269 config
->writeEntry("SelRect", m_zoomView
->getSelRectPos());
270 config
->writeEntry("ShowMouse", m_zoomView
->getShowMouseType());
272 if (m_modeFollowMouse
->isChecked())
273 config
->writeEntry("Mode", "followmouse");
274 else if (m_modeWholeScreen
->isChecked())
275 config
->writeEntry("Mode", "wholescreen");
276 else if (m_modeSelWin
->isChecked())
277 config
->writeEntry("Mode", "selectionwindow");
279 config
->writeEntry("ShowMenu", m_pShowMenu
->isChecked());
280 config
->writeEntry("ShowMainToolBar", m_pShowMainToolBar
->isChecked());
281 config
->writeEntry("ShowViewToolBar", m_pShowViewToolBar
->isChecked());
282 config
->writeEntry("ShowSettingsToolBar", m_pShowSettingsToolBar
->isChecked());
284 toolBar("mainToolBar")->saveSettings(config
,"Main ToolBar");
285 toolBar("viewToolBar")->saveSettings(config
,"View ToolBar");
286 toolBar("settingsToolBar")->saveSettings(config
,"Settings ToolBar");
291 * Read settings from config file.
293 void KmagApp::readOptions()
295 QColor
blue (0,0,128);
296 QColor
yellow (255,255,0);
297 QColor
white (255,255,255);
299 config
->setGroup ("WM");
301 config
->readColorEntry("inactiveBackground", &blue
),
302 config
->readColorEntry("inactiveForeground", &white
),
303 config
->readColorEntry("inactiveTitleBtnBg", &yellow
));
305 config
->setGroup("General Options");
307 QSize
defSize(460,390);
308 QSize size
=config
->readSizeEntry("Geometry", &defSize
);
314 // set zoom - defaults to 2x
315 unsigned int zoomIndex
= config
->readUnsignedNumEntry("ZoomIndex", 4);
316 setZoomIndex(zoomIndex
);
317 emit
updateZoomIndex(m_zoomIndex
);
319 unsigned int rotationIndex
= config
->readUnsignedNumEntry("RotationIndex", 0);
320 setRotationIndex(rotationIndex
);
321 emit
updateRotationIndex(m_rotationIndex
);
323 unsigned int fpsIndex
= config
->readUnsignedNumEntry("FPSIndex", 2);
324 setFPSIndex(fpsIndex
);
325 emit
updateFPSIndex(m_fpsIndex
);
327 QString mode
= config
->readEntry("Mode", "followmouse");
328 if (mode
== "wholescreen")
329 slotModeWholeScreen();
330 else if (mode
== "selectionwindow")
333 slotModeFollowMouse();
335 QRect
defaultRect(0,0,211,164);
336 m_zoomView
->setSelRectPos(config
->readRectEntry("SelRect", &defaultRect
));
338 m_mouseCursorType
= config
->readUnsignedNumEntry("ShowMouse", m_defaultMouseCursorType
);
339 m_zoomView
->showMouse(m_mouseCursorType
);
340 if(m_mouseCursorType
)
341 m_hideCursor
->setChecked(false);
343 m_hideCursor
->setChecked(true);
345 if(config
->hasGroup("Settings ToolBar"))
346 toolBar("settingsToolBar")->applySettings(config
,"Settings ToolBar");
348 if(config
->hasGroup("Main ToolBar"))
349 toolBar("mainToolBar")->applySettings(config
,"Main ToolBar");
351 if(config
->hasGroup("View ToolBar"))
352 toolBar("viewToolBar")->applySettings(config
,"View ToolBar");
354 m_pShowMenu
->setChecked(config
->readBoolEntry("ShowMenu", true));
357 m_pShowMainToolBar
->setChecked(config
->readBoolEntry("ShowMainToolBar", false));
358 slotShowMainToolBar();
360 m_pShowViewToolBar
->setChecked(config
->readBoolEntry("ShowViewToolBar", true));
361 slotShowViewToolBar();
363 m_pShowSettingsToolBar
->setChecked(config
->readBoolEntry("ShowSettingsToolBar", true));
364 slotShowSettingsToolBar();
367 bool KmagApp::queryClose()
372 bool KmagApp::queryExit()
379 * Called when mouse is clicked inside the window
383 void KmagApp::contextMenuEvent ( QContextMenuEvent
* e
)
386 KXMLGUIFactory
*factory
= this->factory();
387 QMenu
*popup
= (QMenu
*)factory
->container("mainPopUp",this);
389 popup
->popup(e
->globalPos(), 0);
394 /////////////////////////////////////////////////////////////////////
395 // SLOT IMPLEMENTATION
396 /////////////////////////////////////////////////////////////////////
399 * Shows/hides the mouse cursor
401 void KmagApp::showMouseCursor(bool show
)
404 if(m_mouseCursorType
== 0)
405 m_mouseCursorType
= m_defaultMouseCursorType
;
406 m_zoomView
->showMouse(m_mouseCursorType
);
408 m_zoomView
->showMouse(0);
415 void KmagApp::zoomIn()
417 // set the new index .. checking will done inside setZoom
418 setZoomIndex(m_zoomIndex
+1);
419 // signal change in zoom index
420 emit
updateZoomIndex((int)m_zoomIndex
);
426 void KmagApp::zoomOut()
428 // set the new index .. checking will done inside setZoom
429 setZoomIndex(m_zoomIndex
-1);
430 // signal change in zoom index
431 emit
updateZoomIndex((int)m_zoomIndex
);
434 * Sets the zoom index to index
436 void KmagApp::setZoomIndex(int index
)
438 if(index
< 0 || index
>= (int)zoomArray
.size()) {
439 // the index is invalid
440 kdWarning() << "Invalid index!" << endl
;
442 } else if((int)m_zoomIndex
== index
) {
449 if(m_zoomIndex
== 0) {
450 // meaning that no more zooming-out is possible
451 // -> disable zoom-out icon
452 m_pZoomOut
->setEnabled(false);
453 } else { // enable the icon
454 m_pZoomOut
->setEnabled(true);
457 if(m_zoomIndex
== zoomArray
.size()-1) {
458 // meaning that no more zooming-in is possible
459 // -> disable zoom-in icon
460 m_pZoomIn
->setEnabled(false);
461 } else { // enable the icon
462 m_pZoomIn
->setEnabled(true);
465 // signal change in zoom value
466 emit
updateZoomValue(zoomArray
[m_zoomIndex
]);
470 * Sets the rotation index to index
472 void KmagApp::setRotationIndex(int index
)
474 if(index
< 0 || index
>= (int)rotationArray
.size()) {
475 // the index is invalid
476 kdWarning() << "Invalid index!" << endl
;
478 } else if((int)m_rotationIndex
== index
) {
482 m_rotationIndex
= index
;
485 // signal change in zoom value
486 emit
updateRotationValue(rotationArray
[m_rotationIndex
]);
490 * Sets the fps index to index
492 void KmagApp::setFPSIndex(int index
)
494 if(index
< 0 || index
>= (int)fpsArray
.size()) {
495 // the index is invalid
496 kdWarning() << "Invalid index!" << endl
;
498 } else if((int)m_fpsIndex
== index
) {
505 // signal change in fps value
506 emit
updateFPSValue(fpsArray
[m_fpsIndex
]);
511 * Save the zoomed image
513 void KmagApp::saveZoomPixmap()
517 // stop refresh temporarily
518 if (m_zoomView
->getRefreshStatus()) {
523 KURL url
= KFileDialog::getSaveURL(QString::null
,
524 KImageIO::pattern(KImageIO::Writing
),
525 0,i18n("Save Snapshot As"));
527 if(!url
.fileName().isEmpty()) {
528 if(!url
.isLocalFile()) {
529 // create a temp file.. save image to it.. copy over the n/w and then delete the temp file.
531 if(!m_zoomView
->getPixmap().save(tempFile
.name(), KImageIO::type(url
.fileName()).latin1())) {
532 KMessageBox::error(0, i18n("Unable to save temporary file (before uploading to the network file you specified)."),
533 i18n("Error Writing File"));
535 if(!KIO::NetAccess::upload(tempFile
.name(), url
, this)) {
536 KMessageBox::error(0, i18n("Unable to upload file over the network."),
537 i18n("Error Writing File"));
539 KMessageBox::information(0, i18n("Current zoomed image saved to\n%1").arg(url
.prettyURL()),
540 i18n("Information"), "save_confirm");
543 // remove the temporary file
547 if(!m_zoomView
->getPixmap().save(url
.path(), KImageIO::type(url
.fileName()).latin1())) {
548 KMessageBox::error(0, i18n("Unable to save file. Please check if you have permission to write to the directory."),
549 i18n("Error Writing File"));
551 KMessageBox::information(0, i18n("Current zoomed image saved to\n%1").arg(url
.prettyURL()),
552 i18n("Information"), "save_confirm");
562 void KmagApp::slotToggleRefresh()
564 m_zoomView
->toggleRefresh();
565 if(m_zoomView
->getRefreshStatus()) {
566 refreshSwitch
->setIcon("stop.png");
567 refreshSwitch
->setText(i18n("Stop"));
568 refreshSwitch
->setToolTip(i18n("Click to stop window update"));
570 refreshSwitch
->setIcon("reload.png");
571 refreshSwitch
->setText(i18n("Start"));
572 refreshSwitch
->setToolTip(i18n("Click to start window update"));
577 void KmagApp::slotModeWholeScreen()
579 m_zoomView
->setSelRectPos(QRect (0, 0, QApplication::desktop()->width(), QApplication::desktop()->height()));
580 m_zoomView
->followMouse(false);
581 m_zoomView
->showSelRect(false);
582 m_zoomView
->setFitToWindow (false);
583 m_modeFollowMouse
->setChecked(false);
584 m_modeWholeScreen
->setChecked(true);
585 m_modeSelWin
->setChecked(false);
589 void KmagApp::slotModeSelWin()
591 m_zoomView
->followMouse(false);
592 m_zoomView
->showSelRect(true);
593 m_zoomView
->setFitToWindow (false);
594 m_modeFollowMouse
->setChecked(false);
595 m_modeWholeScreen
->setChecked(false);
596 m_modeSelWin
->setChecked(true);
600 void KmagApp::slotModeFollowMouse()
602 m_zoomView
->followMouse(true);
603 m_zoomView
->showSelRect(false);
604 m_zoomView
->setFitToWindow (true);
605 m_modeFollowMouse
->setChecked(true);
606 m_modeWholeScreen
->setChecked(false);
607 m_modeSelWin
->setChecked(false);
611 void KmagApp::slotToggleHideCursor()
613 showMouseCursor(!m_hideCursor
->isChecked());
617 void KmagApp::slotFileNewWindow()
619 KmagApp
*new_window
= new KmagApp();
624 void KmagApp::slotFilePrint()
626 #ifndef QT_NO_PRINTER
630 #if KDE_VERSION < 220
636 // stop refresh temporarily
637 if (m_zoomView
->getRefreshStatus()) {
642 const QPixmap
pixmap(m_zoomView
->getPixmap());
644 #if KDE_VERSION >= 220
645 // use some AI to get the best orientation
646 if(pixmap
.width() > pixmap
.height()) {
647 printer
.setOrientation(KPrinter::Landscape
);
649 printer
.setOrientation(KPrinter::Portrait
);
653 if (printer
.setup(this)) {
656 if(!paint
.begin(&printer
))
659 paint
.drawPixmap(0, 0, pixmap
);
667 #endif // QT_NO_PRINTER
670 void KmagApp::slotFileQuit()
673 // close the first window, the list makes the next one the first again.
674 // This ensures that queryClose() is called on each window to ask for closing
676 if (!memberList().isEmpty())
678 for (int i
= 0; i
< memberList().size(); ++i
)
680 w
= memberList().at(i
);
681 // only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
682 // the window and the application stay open.
685 #warning "kde4: now memberList() is constant => we can't remove some element!"
686 //memberList()->removeRef(w);
691 void KmagApp::copyToClipBoard()
693 QClipboard
*cb
=KApplication::clipboard();
694 cb
->setPixmap(m_zoomView
->getPixmap());
697 void KmagApp::slotShowMenu()
699 ///////////////////////////////////////////////////////////////////
700 // turn Menu on or off
701 if(!m_pShowMenu
->isChecked())
713 void KmagApp::slotShowMainToolBar()
715 ///////////////////////////////////////////////////////////////////
716 // turn mainToolbar on or off
717 if(!m_pShowMainToolBar
->isChecked())
719 toolBar("mainToolBar")->hide();
723 toolBar("mainToolBar")->show();
727 void KmagApp::slotShowViewToolBar()
729 ///////////////////////////////////////////////////////////////////
730 // turn viewToolbar on or off
731 if(!m_pShowViewToolBar
->isChecked())
733 toolBar("viewToolBar")->hide();
737 toolBar("viewToolBar")->show();
741 void KmagApp::slotShowSettingsToolBar()
743 ///////////////////////////////////////////////////////////////////
744 // turn viewToolbar on or off
745 if(!m_pShowSettingsToolBar
->isChecked())
747 toolBar("settingsToolBar")->hide();
751 toolBar("settingsToolBar")->show();
755 void KmagApp::slotConfKeys()
757 KKeyDialog::configure( actionCollection() );
760 void KmagApp::slotEditToolbars()
762 saveMainWindowSettings( KGlobal::config(), "MainWindow" );
763 KEditToolbar
dlg( actionCollection() );
764 connect( &dlg
, SIGNAL( newToolbarConfig() ), this, SLOT( slotNewToolbarConfig() ) );
770 void KmagApp::slotNewToolbarConfig()
772 applyMainWindowSettings( KGlobal::config(), "MainWindow" );