[Kde-accessibility] kmag issues

Olaf Jan Schmidt olaf@amen-online.de
Fri, 24 Jan 2003 01:12:56 +0100


--------------Boundary-00=_K9Z6MUKTVF8OSWTJSUHG
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Sarang!

[Myself]
> 1. The file menu in kmag is empty. A patch is attached.

Update: I added "Quit" and "Print" to the file menu, and corrected a=20
spelling mistake ("zommed images").

New patches attached.

OK to commit?

BTW, it would be nice if all the buttons in the toolbar also had a menu=20
entry, but the rest is more difficult, so I stopped here.

Olaf.

- --=20
Olaf Jan Schmidt, KDE Accessibility Project
KDEAP co-maintainer, maintainer of http://accessibility.kde.org

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj4whQgACgkQoLYC8AehV8fWOwCg1EYSKMm+PXdnKXIyKJUd/q98
zEUAn0LhUDqbcNNcUhsZvJMRsgQfjr7u
=3DYKfb
-----END PGP SIGNATURE-----

--------------Boundary-00=_K9Z6MUKTVF8OSWTJSUHG
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="kmag.cpp.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kmag.cpp.diff"

Index: kmag/kmag.cpp
===================================================================
RCS file: /home/kde/kdeaccessibility/kmag/kmag.cpp,v
retrieving revision 1.30
diff -u -3 -p -r1.30 kmag.cpp
--- kmag/kmag.cpp	22 Jan 2003 19:37:06 -0000	1.30
+++ kmag/kmag.cpp	24 Jan 2003 00:08:45 -0000
@@ -102,7 +102,7 @@ KmagApp::KmagApp(QWidget* , const char* 
   initView();
   initActions();
 	initConnections();
-	
+
   // read options from config file
   readOptions();
 
@@ -121,9 +121,17 @@ KmagApp::~KmagApp()
 void KmagApp::initActions()
 {
   fileNewWindow = new KAction(i18n("New &Window"), "window_new", KStdAccel::key(KStdAccel::New), this,
-															SLOT(slotFileNewWindow()), actionCollection(),"new_window");
+															SLOT(slotFileNewWindow()), actionCollection(),"file_new_window");
   fileNewWindow->setToolTip(i18n("Open a new KMagnifier window"));
 
+  filePrint = KStdAction::print(this, SLOT(slotFilePrint()), actionCollection());
+  filePrint->setStatusText(i18n("Print the current zoomed image"));
+  filePrint->setWhatsThis (i18n("Print the current zoomed image"));
+
+  fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection());
+  fileQuit->setStatusText(i18n("Quits the application"));
+  fileQuit->setWhatsThis (i18n("Quits the application"));
+
 	refreshSwitch = new KAction(i18n("Stop"), "stop", KStdAccel::key(KStdAccel::Reload), this,
 															SLOT(slotToggleRefresh()), actionCollection(), "start_stop_refresh");
   refreshSwitch->setToolTip(i18n("Click to stop window refresh"));
@@ -137,7 +145,7 @@ void KmagApp::initActions()
 	m_pSnapshot->setToolTip(i18n("Save image to a file"));
 
   m_pPrint = KStdAction::print(this, SLOT(slotFilePrint()), actionCollection(), "print");
-  m_pPrint->setWhatsThis(i18n("Click on this button to print the current zommed image."));
+  m_pPrint->setWhatsThis(i18n("Print the current zoomed image."));
 
   m_pCopy = KStdAction::copy(this, SLOT(copyToClipBoard()), actionCollection(), "copy");
   m_pCopy->setWhatsThis(i18n("Click on this button to copy the current zommed image to the clipboard."));
@@ -228,7 +236,7 @@ void KmagApp::initView()
 	QWhatsThis::add(m_followMouseButton, i18n("If selected, the area around the mouse cursor is magnified") );
   settingsGroupLayout->addWidget( m_followMouseButton );
 	connect(m_followMouseButton, SIGNAL(toggled(bool)), m_zoomView, SLOT(followMouse(bool)));
-  
+
 	m_showCursorButton = new QCheckBox( m_settingsGroup, "m_showCursorButton" );
   m_showCursorButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, m_followMouseButton->sizePolicy().hasHeightForWidth() ) );
   m_showCursorButton->setText( i18n( "Mouse cursor" ) );
@@ -268,7 +276,7 @@ void KmagApp::initConnections()
  * Save options to config file.
  */
 void KmagApp::saveOptions()
-{	
+{
   config->setGroup("General Options");
   config->writeEntry("Geometry", size());
 	config->writeEntry("ZoomIndex", m_zoomIndex);
@@ -428,7 +436,7 @@ void KmagApp::setZoomIndex(int index)
   } else { // enable the icon
 		m_pZoomIn->setEnabled(true);
 	}
-	
+
 	// signal change in zoom value
 	emit updateZoomValue(zoomArray[m_zoomIndex]);
 }
@@ -527,7 +535,6 @@ void KmagApp::slotFileNewWindow()
   new_window->show();
 }
 
-
 void KmagApp::slotFilePrint()
 {
 #ifndef QT_NO_PRINTER
@@ -572,6 +579,26 @@ void KmagApp::slotFilePrint()
 		slotToggleRefresh();
 	}
 #endif // QT_NO_PRINTER
+}
+
+
+void KmagApp::slotFileQuit()
+{
+  saveOptions();
+  // close the first window, the list makes the next one the first again.
+  // This ensures that queryClose() is called on each window to ask for closing
+  KMainWindow* w;
+  if (memberList)
+  {
+    for(w=memberList->first(); w!=0; w=memberList->first())
+    {
+      // only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
+      // the window and the application stay open.
+      if(!w->close())
+         break;
+      memberList->removeRef(w);
+    }
+  }
 }
 
 void KmagApp::copyToClipBoard()

--------------Boundary-00=_K9Z6MUKTVF8OSWTJSUHG
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="kmag.h.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kmag.h.diff"

Index: kmag/kmag.h
===================================================================
RCS file: /home/kde/kdeaccessibility/kmag/kmag.h,v
retrieving revision 1.15
diff -u -3 -p -r1.15 kmag.h
--- kmag/kmag.h	24 Nov 2002 05:31:58 -0000	1.15
+++ kmag/kmag.h	24 Jan 2003 00:08:52 -0000
@@ -106,6 +106,11 @@ class KmagApp : public KMainWindow
     /** open a new application window by creating a new instance of KmagApp */
     void slotFileNewWindow();
 
+    /** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
+     * If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.
+     */
+    void slotFileQuit();
+
     /** print the actual file */
     void slotFilePrint();
 

--------------Boundary-00=_K9Z6MUKTVF8OSWTJSUHG
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="kmagui.rc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="kmagui.rc.diff"

Index: kmag/kmagui.rc
===================================================================
RCS file: /home/kde/kdeaccessibility/kmag/kmagui.rc,v
retrieving revision 1.2
diff -u -3 -p -r1.2 kmagui.rc
--- kmag/kmagui.rc	22 Apr 2002 21:23:15 -0000	1.2
+++ kmag/kmagui.rc	24 Jan 2003 00:09:05 -0000
@@ -1,8 +1,12 @@
 <!DOCTYPE kpartgui>
 <kpartgui name="kmag" version="0.3">
  <MenuBar>
-   <Menu name="file"><text>&amp;File</text>
+   <Menu noMerge="1" name="file"><text>&amp;File</text>
      <Action name="file_new_window"/>
+     <Separator />
+     <Action name="file_print"/>
+     <Separator />
+     <Action name="file_quit"/>
    </Menu>
  </MenuBar>
  <ToolBar noMerge="1" name="mainToolBar">

--------------Boundary-00=_K9Z6MUKTVF8OSWTJSUHG--