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>
33 #include <QContextMenuEvent>
35 #include <QDesktopWidget>
36 #include <kdeversion.h>
37 #include <kxmlguifactory.h>
39 // include files for KDE
41 #include <kapplication.h>
43 #include <kapplication.h>
46 #include <kkeydialog.h>
47 #include <kiconloader.h>
48 #include <kmessagebox.h>
49 #include <kfiledialog.h>
54 #include <kstdaction.h>
55 #include <khelpmenu.h>
58 #include <kio/netaccess.h>
59 #include <ktempfile.h>
61 #include <kedittoolbar.h>
70 // application specific includes
72 #include "kmagzoomview.h"
73 #include "kmagselrect.h"
76 #define havesetCheckedState
78 KmagApp::KmagApp(QWidget
* , const char* name
)
79 : KMainWindow(0, name
, Qt::WStyle_MinMax
| Qt::WType_TopLevel
| Qt::WDestructiveClose
| Qt::WStyle_ContextHelp
| Qt::WStyle_StaysOnTop
),
80 m_defaultMouseCursorType(2)
82 config
=KGlobal::config();
84 zoomArrayString
<< "5:1" << "2:1" << "1:1" << "1:1.5" << "1:2" << "1:3" << "1:4" << "1:5"
85 << "1:6" << "1:7" << "1:8" << "1:12" << "1:16" << "1:20";
87 // Is there a better way to initialize a vector array?
88 zoomArray
.push_back(0.2); zoomArray
.push_back(0.5); zoomArray
.push_back(1.0);
89 zoomArray
.push_back(1.5); zoomArray
.push_back(2.0); zoomArray
.push_back(3.0);
90 zoomArray
.push_back(4.0); zoomArray
.push_back(5.0); zoomArray
.push_back(6.0); zoomArray
.push_back(7.0);
91 zoomArray
.push_back(8.0); zoomArray
.push_back(12.0); zoomArray
.push_back(16.0); zoomArray
.push_back(20.0);
93 fpsArrayString
<< i18n("&Very Low") << i18n("&Low") << i18n("&Medium") << i18n("&High") << i18n("V&ery High");
95 fpsArray
.push_back(2); // very low
96 fpsArray
.push_back(6); // low
97 fpsArray
.push_back(10); // medium
98 fpsArray
.push_back(15); // high
99 fpsArray
.push_back(25); // very high
101 rotationArrayString
<< i18n("&No Rotation (0°)") << i18n("&Left (90°)") << i18n("&Upside Down (180°)") << i18n("&Right (270°)");
103 rotationArray
.push_back(0); // no rotation
104 rotationArray
.push_back(90); // left
105 rotationArray
.push_back(180); // upside down
106 rotationArray
.push_back(270); // right
108 // call inits to invoke all other construction parts
113 // read options from config file
119 * Default destructor.
123 m_zoomView
->showSelRect(false);
126 void KmagApp::initActions()
128 fileNewWindow
= new KAction(i18n("New &Window"), "window_new", KStdAccel::openNew(), this,
129 SLOT(slotFileNewWindow()), actionCollection(),"new_window");
130 fileNewWindow
->setToolTip(i18n("Open a new KMagnifier window"));
132 refreshSwitch
= new KAction(i18n("&Stop"), "stop", KStdAccel::reload(), this,
133 SLOT(slotToggleRefresh()), actionCollection(), "start_stop_refresh");
134 refreshSwitch
->setToolTip(i18n("Click to stop window refresh"));
135 refreshSwitch
->setWhatsThis(i18n("Clicking on this icon will <b>start</b> / <b>stop</b>\
136 updating of the display. Stopping the update will zero the processing power\
137 required (CPU usage)"));
139 m_pSnapshot
= new KAction(i18n("&Save Snapshot As..."), "ksnapshot", KStdAccel::save(), this,
140 SLOT(saveZoomPixmap()), actionCollection(),"snapshot");
141 m_pSnapshot
->setWhatsThis(i18n("Saves the zoomed view to an image file."));
142 m_pSnapshot
->setToolTip(i18n("Save image to a file"));
144 m_pPrint
= KStdAction::print(this, SLOT(slotFilePrint()), actionCollection(), "print");
145 m_pPrint
->setWhatsThis(i18n("Click on this button to print the current zoomed view."));
147 m_pQuit
= KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection(), "quit");
148 m_pQuit
->setToolTip(i18n("Quits the application"));
149 m_pQuit
->setWhatsThis (i18n("Quits the application"));
151 m_pCopy
= KStdAction::copy(this, SLOT(copyToClipBoard()), actionCollection(), "copy");
152 m_pCopy
->setWhatsThis(i18n("Click on this button to copy the current zoomed view to the clipboard which you can paste in other applications."));
153 m_pCopy
->setToolTip(i18n("Copy zoomed image to clipboard"));
155 m_pShowMenu
= new KToggleAction(i18n("Show &Menu"), "showmenu", Qt::CTRL
+Qt::Key_M
, this,
156 SLOT(slotShowMenu()), actionCollection(),"show_menu");
157 #ifdef havesetCheckedState
158 m_pShowMenu
->setCheckedState(i18n("Hide &Menu"));
160 m_pShowMainToolBar
= new KToggleAction(i18n("Show Main &Toolbar"), 0, 0, this,
161 SLOT(slotShowMainToolBar()), actionCollection(),"show_mainToolBar");
162 #ifdef havesetCheckedState
163 m_pShowMainToolBar
->setCheckedState(i18n("Hide Main &Toolbar"));
165 m_pShowViewToolBar
= new KToggleAction(i18n("Show &View Toolbar"), 0, 0, this,
166 SLOT(slotShowViewToolBar()), actionCollection(),"show_viewToolBar");
167 #ifdef havesetCheckedState
168 m_pShowViewToolBar
->setCheckedState(i18n("Hide &View Toolbar"));
170 m_pShowSettingsToolBar
= new KToggleAction(i18n("Show &Settings Toolbar"), 0, 0, this,
171 SLOT(slotShowSettingsToolBar()), actionCollection(),"show_settingsToolBar");
172 #ifdef havesetCheckedState
173 m_pShowSettingsToolBar
->setCheckedState(i18n("Hide &Settings Toolbar"));
176 m_modeFollowMouse
= new KRadioAction(i18n("&Follow Mouse Mode"), "followmouse", Qt::Key_F1
, this,
177 SLOT(slotModeFollowMouse()), actionCollection(), "mode_followmouse");
178 m_modeFollowMouse
->setToolTip(i18n("Magnify around the mouse cursor"));
179 m_modeFollowMouse
->setWhatsThis(i18n("If selected, the area around the mouse cursor is magnified"));
181 m_modeSelWin
= new KRadioAction(i18n("Se&lection Window Mode"), "window", Qt::Key_F2
, this,
182 SLOT(slotModeSelWin()), actionCollection(), "mode_selectionwindow");
183 m_modeSelWin
->setToolTip(i18n("Show a window for selecting the magnified area"));
185 m_modeWholeScreen
= new KRadioAction(i18n("&Whole Screen Mode"), "window_fullscreen", Qt::Key_F3
, this,
186 SLOT(slotModeWholeScreen()), actionCollection(),"mode_wholescreen");
187 m_modeWholeScreen
->setToolTip(i18n("Magnify the whole screen"));
188 m_modeWholeScreen
->setWhatsThis(i18n("Click on this button to fit the zoom view to the zoom window."));
190 m_hideCursor
= new KToggleAction(i18n("Hide Mouse &Cursor"), "hidemouse", Qt::Key_F4
, this,
191 SLOT(slotToggleHideCursor()), actionCollection(), "hidecursor");
192 #ifdef havesetCheckedState
193 m_hideCursor
->setCheckedState(i18n("Show Mouse &Cursor"));
195 m_hideCursor
->setToolTip(i18n("Hide the mouse cursor"));
197 m_pZoomIn
= KStdAction::zoomIn(this, SLOT(zoomIn()), actionCollection(), "zoom_in");
198 m_pZoomIn
->setWhatsThis(i18n("Click on this button to <b>zoom-in</b> on the selected region."));
200 m_pZoomBox
= new KSelectAction(i18n("&Zoom"),0,actionCollection(),"zoom");
201 m_pZoomBox
->setItems(zoomArrayString
);
202 m_pZoomBox
->setWhatsThis(i18n("Select the zoom factor."));
203 m_pZoomBox
->setToolTip(i18n("Zoom factor"));
205 m_pZoomOut
= KStdAction::zoomOut(this, SLOT(zoomOut()), actionCollection(), "zoom_out");
206 m_pZoomOut
->setWhatsThis(i18n("Click on this button to <b>zoom-out</b> on the selected region."));
208 m_pRotationBox
= new KSelectAction(i18n("&Rotation"),0,actionCollection(),"rotation");
209 m_pRotationBox
->setItems(rotationArrayString
);
210 m_pRotationBox
->setWhatsThis(i18n("Select the rotation degree."));
211 m_pRotationBox
->setToolTip(i18n("Rotation degree"));
213 // KHelpMenu *newHelpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData());
215 m_keyConf
= KStdAction::keyBindings( this, SLOT( slotConfKeys() ), actionCollection(), "key_conf");
216 m_toolConf
= KStdAction::configureToolbars( this, SLOT( slotEditToolbars() ),
217 actionCollection(), "toolbar_conf");
219 m_pFPSBox
= new KSelectAction(i18n("&Refresh"),0,actionCollection(),"fps_selector");
220 m_pFPSBox
->setItems(fpsArrayString
);
221 m_pFPSBox
->setWhatsThis(i18n("Select the refresh rate. The higher the rate, the more computing power (CPU) will be needed."));
222 m_pFPSBox
->setToolTip(i18n("Refresh rate"));
227 void KmagApp::initView()
229 m_zoomView
= new KMagZoomView( this, "ZoomView" );
230 m_zoomView
->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType
)7, (QSizePolicy::SizeType
)7, m_zoomView
->sizePolicy().hasHeightForWidth() ) );
231 m_zoomView
->setFrameShape( QFrame::StyledPanel
);
232 m_zoomView
->setFrameShadow( QFrame::Raised
);
234 setCentralWidget(m_zoomView
);
238 * Initialize all connections.
240 void KmagApp::initConnections()
242 // change in zoom value -> update the view
243 connect(this, SIGNAL(updateZoomValue(float)), m_zoomView
, SLOT(setZoom(float)));
244 connect(this, SIGNAL(updateRotationValue(int)), m_zoomView
, SLOT(setRotation(int)));
245 connect(this, SIGNAL(updateFPSValue(float)), m_zoomView
, SLOT(setRefreshRate(float)));
247 // change in zoom index -> update the selector
248 connect(this, SIGNAL(updateZoomIndex(int)), m_pZoomBox
, SLOT(setCurrentItem(int)));
249 connect(this, SIGNAL(updateRotationIndex(int)), m_pRotationBox
, SLOT(setCurrentItem(int)));
250 connect(this, SIGNAL(updateFPSIndex(int)), m_pFPSBox
, SLOT(setCurrentItem(int)));
252 // selector selects a zoom index -> set the zoom index
253 connect(m_pZoomBox
, SIGNAL(activated(int)), this, SLOT(setZoomIndex(int)));
254 connect(m_pRotationBox
, SIGNAL(activated(int)), this, SLOT(setRotationIndex(int)));
255 connect(m_pFPSBox
, SIGNAL(activated(int)), this, SLOT(setFPSIndex(int)));
259 * Save options to config file.
261 void KmagApp::saveOptions()
263 config
->setGroup("General Options");
264 config
->writeEntry("Geometry", size());
265 config
->writeEntry("ZoomIndex", m_zoomIndex
);
266 config
->writeEntry("RotationIndex", m_rotationIndex
);
267 config
->writeEntry("FPSIndex", m_fpsIndex
);
268 config
->writeEntry("SelRect", m_zoomView
->getSelRectPos());
269 config
->writeEntry("ShowMouse", m_zoomView
->getShowMouseType());
271 if (m_modeFollowMouse
->isChecked())
272 config
->writeEntry("Mode", "followmouse");
273 else if (m_modeWholeScreen
->isChecked())
274 config
->writeEntry("Mode", "wholescreen");
275 else if (m_modeSelWin
->isChecked())
276 config
->writeEntry("Mode", "selectionwindow");
278 config
->writeEntry("ShowMenu", m_pShowMenu
->isChecked());
279 config
->writeEntry("ShowMainToolBar", m_pShowMainToolBar
->isChecked());
280 config
->writeEntry("ShowViewToolBar", m_pShowViewToolBar
->isChecked());
281 config
->writeEntry("ShowSettingsToolBar", m_pShowSettingsToolBar
->isChecked());
283 toolBar("mainToolBar")->saveSettings(config
,"Main ToolBar");
284 toolBar("viewToolBar")->saveSettings(config
,"View ToolBar");
285 toolBar("settingsToolBar")->saveSettings(config
,"Settings ToolBar");
290 * Read settings from config file.
292 void KmagApp::readOptions()
294 QColor
blue (0,0,128);
295 QColor
yellow (255,255,0);
296 QColor
white (255,255,255);
298 config
->setGroup ("WM");
300 config
->readEntry("inactiveBackground", blue
),
301 config
->readEntry("inactiveForeground", white
),
302 config
->readEntry("inactiveTitleBtnBg", yellow
));
304 config
->setGroup("General Options");
306 QSize
defSize(460,390);
307 QSize size
=config
->readEntry("Geometry", defSize
);
313 // set zoom - defaults to 2x
314 unsigned int zoomIndex
= config
->readEntry("ZoomIndex", 4);
315 setZoomIndex(zoomIndex
);
316 emit
updateZoomIndex(m_zoomIndex
);
318 unsigned int rotationIndex
= config
->readEntry("RotationIndex", 0);
319 setRotationIndex(rotationIndex
);
320 emit
updateRotationIndex(m_rotationIndex
);
322 unsigned int fpsIndex
= config
->readEntry("FPSIndex", 2);
323 setFPSIndex(fpsIndex
);
324 emit
updateFPSIndex(m_fpsIndex
);
326 QString mode
= config
->readEntry("Mode", "followmouse");
327 if (mode
== "wholescreen")
328 slotModeWholeScreen();
329 else if (mode
== "selectionwindow")
332 slotModeFollowMouse();
334 QRect
defaultRect(0,0,211,164);
335 m_zoomView
->setSelRectPos(config
->readEntry("SelRect", defaultRect
));
337 m_mouseCursorType
= config
->readEntry("ShowMouse", m_defaultMouseCursorType
);
338 m_zoomView
->showMouse(m_mouseCursorType
);
339 if(m_mouseCursorType
)
340 m_hideCursor
->setChecked(false);
342 m_hideCursor
->setChecked(true);
344 if(config
->hasGroup("Settings ToolBar"))
345 toolBar("settingsToolBar")->applySettings(config
,"Settings ToolBar");
347 if(config
->hasGroup("Main ToolBar"))
348 toolBar("mainToolBar")->applySettings(config
,"Main ToolBar");
350 if(config
->hasGroup("View ToolBar"))
351 toolBar("viewToolBar")->applySettings(config
,"View ToolBar");
353 m_pShowMenu
->setChecked(config
->readEntry("ShowMenu", QVariant(true)).toBool());
356 m_pShowMainToolBar
->setChecked(config
->readEntry("ShowMainToolBar", QVariant(false)).toBool());
357 slotShowMainToolBar();
359 m_pShowViewToolBar
->setChecked(config
->readEntry("ShowViewToolBar", QVariant(true)).toBool());
360 slotShowViewToolBar();
362 m_pShowSettingsToolBar
->setChecked(config
->readEntry("ShowSettingsToolBar", QVariant(true)).toBool());
363 slotShowSettingsToolBar();
366 bool KmagApp::queryClose()
371 bool KmagApp::queryExit()
378 * Called when mouse is clicked inside the window
382 void KmagApp::contextMenuEvent ( QContextMenuEvent
* e
)
385 KXMLGUIFactory
*factory
= this->factory();
386 QMenu
*popup
= (QMenu
*)factory
->container("mainPopUp",this);
388 popup
->popup(e
->globalPos(), 0);
393 /////////////////////////////////////////////////////////////////////
394 // SLOT IMPLEMENTATION
395 /////////////////////////////////////////////////////////////////////
398 * Shows/hides the mouse cursor
400 void KmagApp::showMouseCursor(bool show
)
403 if(m_mouseCursorType
== 0)
404 m_mouseCursorType
= m_defaultMouseCursorType
;
405 m_zoomView
->showMouse(m_mouseCursorType
);
407 m_zoomView
->showMouse(0);
414 void KmagApp::zoomIn()
416 // set the new index .. checking will done inside setZoom
417 setZoomIndex(m_zoomIndex
+1);
418 // signal change in zoom index
419 emit
updateZoomIndex((int)m_zoomIndex
);
425 void KmagApp::zoomOut()
427 // set the new index .. checking will done inside setZoom
428 setZoomIndex(m_zoomIndex
-1);
429 // signal change in zoom index
430 emit
updateZoomIndex((int)m_zoomIndex
);
433 * Sets the zoom index to index
435 void KmagApp::setZoomIndex(int index
)
437 if(index
< 0 || index
>= (int)zoomArray
.size()) {
438 // the index is invalid
439 kWarning() << "Invalid index!" << endl
;
441 } else if((int)m_zoomIndex
== index
) {
448 if(m_zoomIndex
== 0) {
449 // meaning that no more zooming-out is possible
450 // -> disable zoom-out icon
451 m_pZoomOut
->setEnabled(false);
452 } else { // enable the icon
453 m_pZoomOut
->setEnabled(true);
456 if(m_zoomIndex
== zoomArray
.size()-1) {
457 // meaning that no more zooming-in is possible
458 // -> disable zoom-in icon
459 m_pZoomIn
->setEnabled(false);
460 } else { // enable the icon
461 m_pZoomIn
->setEnabled(true);
464 // signal change in zoom value
465 emit
updateZoomValue(zoomArray
[m_zoomIndex
]);
469 * Sets the rotation index to index
471 void KmagApp::setRotationIndex(int index
)
473 if(index
< 0 || index
>= (int)rotationArray
.size()) {
474 // the index is invalid
475 kWarning() << "Invalid index!" << endl
;
477 } else if((int)m_rotationIndex
== index
) {
481 m_rotationIndex
= index
;
484 // signal change in zoom value
485 emit
updateRotationValue(rotationArray
[m_rotationIndex
]);
489 * Sets the fps index to index
491 void KmagApp::setFPSIndex(int index
)
493 if(index
< 0 || index
>= (int)fpsArray
.size()) {
494 // the index is invalid
495 kWarning() << "Invalid index!" << endl
;
497 } else if((int)m_fpsIndex
== index
) {
504 // signal change in fps value
505 emit
updateFPSValue(fpsArray
[m_fpsIndex
]);
510 * Save the zoomed image
512 void KmagApp::saveZoomPixmap()
516 // stop refresh temporarily
517 if (m_zoomView
->getRefreshStatus()) {
522 KUrl url
= KFileDialog::getSaveURL(QString(),
523 KImageIO::pattern(KImageIO::Writing
),
524 0,i18n("Save Snapshot As"));
526 if(!url
.fileName().isEmpty()) {
527 if(!url
.isLocalFile()) {
528 // create a temp file.. save image to it.. copy over the n/w and then delete the temp file.
530 #warning "kde4: port KImageIO::type \n";
531 if(!m_zoomView
->getPixmap().save(tempFile
.name(),"png"/*, 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 #warning "kde4 : port KImageIO::type(...) \n";
548 if(!m_zoomView
->getPixmap().save(url
.path(), "png"/*KImageIO::type(url.fileName()).latin1()*/)) {
549 KMessageBox::error(0, i18n("Unable to save file. Please check if you have permission to write to the directory."),
550 i18n("Error Writing File"));
552 KMessageBox::information(0, i18n("Current zoomed image saved to\n%1").arg(url
.prettyURL()),
553 i18n("Information"), "save_confirm");
563 void KmagApp::slotToggleRefresh()
565 m_zoomView
->toggleRefresh();
566 if(m_zoomView
->getRefreshStatus()) {
567 refreshSwitch
->setIcon("stop.png");
568 refreshSwitch
->setText(i18n("Stop"));
569 refreshSwitch
->setToolTip(i18n("Click to stop window update"));
571 refreshSwitch
->setIcon("reload.png");
572 refreshSwitch
->setText(i18n("Start"));
573 refreshSwitch
->setToolTip(i18n("Click to start window update"));
578 void KmagApp::slotModeWholeScreen()
580 m_zoomView
->setSelRectPos(QRect (0, 0, QApplication::desktop()->width(), QApplication::desktop()->height()));
581 m_zoomView
->followMouse(false);
582 m_zoomView
->showSelRect(false);
583 m_zoomView
->setFitToWindow (false);
584 m_modeFollowMouse
->setChecked(false);
585 m_modeWholeScreen
->setChecked(true);
586 m_modeSelWin
->setChecked(false);
590 void KmagApp::slotModeSelWin()
592 m_zoomView
->followMouse(false);
593 m_zoomView
->showSelRect(true);
594 m_zoomView
->setFitToWindow (false);
595 m_modeFollowMouse
->setChecked(false);
596 m_modeWholeScreen
->setChecked(false);
597 m_modeSelWin
->setChecked(true);
601 void KmagApp::slotModeFollowMouse()
603 m_zoomView
->followMouse(true);
604 m_zoomView
->showSelRect(false);
605 m_zoomView
->setFitToWindow (true);
606 m_modeFollowMouse
->setChecked(true);
607 m_modeWholeScreen
->setChecked(false);
608 m_modeSelWin
->setChecked(false);
612 void KmagApp::slotToggleHideCursor()
614 showMouseCursor(!m_hideCursor
->isChecked());
618 void KmagApp::slotFileNewWindow()
620 KmagApp
*new_window
= new KmagApp();
625 void KmagApp::slotFilePrint()
627 #ifndef QT_NO_PRINTER
631 #if KDE_VERSION < 220
637 // stop refresh temporarily
638 if (m_zoomView
->getRefreshStatus()) {
643 const QPixmap
pixmap(m_zoomView
->getPixmap());
645 #if KDE_VERSION >= 220
646 // use some AI to get the best orientation
647 if(pixmap
.width() > pixmap
.height()) {
648 printer
.setOrientation(KPrinter::Landscape
);
650 printer
.setOrientation(KPrinter::Portrait
);
654 if (printer
.setup(this)) {
657 if(!paint
.begin(&printer
))
660 paint
.drawPixmap(0, 0, pixmap
);
668 #endif // QT_NO_PRINTER
671 void KmagApp::slotFileQuit()
674 // close the first window, the list makes the next one the first again.
675 // This ensures that queryClose() is called on each window to ask for closing
677 if (!memberList().isEmpty())
679 for (int i
= 0; i
< memberList().size(); ++i
)
681 w
= memberList().at(i
);
682 // only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
683 // the window and the application stay open.
686 #warning "kde4: now memberList() is constant => we can't remove some element!"
687 //memberList()->removeRef(w);
692 void KmagApp::copyToClipBoard()
694 QClipboard
*cb
=KApplication::clipboard();
695 cb
->setPixmap(m_zoomView
->getPixmap());
698 void KmagApp::slotShowMenu()
700 ///////////////////////////////////////////////////////////////////
701 // turn Menu on or off
702 if(!m_pShowMenu
->isChecked())
714 void KmagApp::slotShowMainToolBar()
716 ///////////////////////////////////////////////////////////////////
717 // turn mainToolbar on or off
718 if(!m_pShowMainToolBar
->isChecked())
720 toolBar("mainToolBar")->hide();
724 toolBar("mainToolBar")->show();
728 void KmagApp::slotShowViewToolBar()
730 ///////////////////////////////////////////////////////////////////
731 // turn viewToolbar on or off
732 if(!m_pShowViewToolBar
->isChecked())
734 toolBar("viewToolBar")->hide();
738 toolBar("viewToolBar")->show();
742 void KmagApp::slotShowSettingsToolBar()
744 ///////////////////////////////////////////////////////////////////
745 // turn viewToolbar on or off
746 if(!m_pShowSettingsToolBar
->isChecked())
748 toolBar("settingsToolBar")->hide();
752 toolBar("settingsToolBar")->show();
756 void KmagApp::slotConfKeys()
758 KKeyDialog::configure( actionCollection() );
761 void KmagApp::slotEditToolbars()
763 saveMainWindowSettings( KGlobal::config(), "MainWindow" );
764 KEditToolbar
dlg( actionCollection() );
765 connect( &dlg
, SIGNAL( newToolbarConfig() ), this, SLOT( slotNewToolbarConfig() ) );
771 void KmagApp::slotNewToolbarConfig()
773 applyMainWindowSettings( KGlobal::config(), "MainWindow" );