Index: /pykoticon/trunk/tests/test.py
===================================================================
--- /pykoticon/trunk/tests/test.py (revision 90)
+++ /pykoticon/trunk/tests/test.py (revision 91)
@@ -25,4 +25,5 @@
 import sys
 import os
+import time
 import xmlrpclib
 
@@ -31,6 +32,7 @@
     server = xmlrpclib.ServerProxy("http://%s:%s" % (arguments[0], arguments[1]))
     server.nop()
-    print server.openDialog()
+    print "Result : %s" % server.openConfirmDialog("HP2100", "jerome", "345", "this is the title", 5)
     server.nop()
+    time.sleep(10)
     server.quitApplication()
     
Index: /pykoticon/trunk/bin/pykoticon
===================================================================
--- /pykoticon/trunk/bin/pykoticon (revision 89)
+++ /pykoticon/trunk/bin/pykoticon (revision 91)
@@ -89,8 +89,15 @@
         return True
         
-    def export_openDialog(self) :    
-        """Opens a dialog to ask username, password, etc..."""
-        self.logDebug("Open dialog !")
-        return ("jerome", "blah")
+    def export_openConfirmDialog(self, printername, username, jobid, jobtitle, jobsize) :    
+        """Opens a dialog to ask the user to confirm or cancel the print job.
+        
+           Returns True to confirm, False to cancel.
+        """   
+        wx.CallAfter(self.frame.askConfirmation, printername, username, jobid, jobtitle, jobsize)
+        while self.frame.askConfirmationResult is None :
+            time.sleep(0.5)
+        retcode = self.frame.askConfirmationResult    
+        self.frame.askConfirmationResult = None
+        return retcode
         
     def export_nop(self) :    
@@ -116,5 +123,5 @@
     def mainloop(self) :
         """XML-RPC Server's main loop."""
-        self.register_function(self.export_openDialog)
+        self.register_function(self.export_openConfirmDialog)
         self.register_function(self.export_quitApplication)
         self.register_function(self.export_nop)
@@ -134,5 +141,7 @@
     """Main class."""
     def __init__(self, parent, id):
-        wx.Frame.__init__(self, parent, -1, \
+        self.askConfirmationResult = None
+        self.closing = False
+        wx.Frame.__init__(self, parent, wx.ID_ANY, \
                _("PyKota for user %s") % getCurrentUserName(), \
                size = (-1, -1), \
@@ -140,36 +149,34 @@
                      | wxPython.wx.wxSIZE_AUTO_HEIGHT \
                      | wxPython.wx.wxSIZE_AUTO_WIDTH \
-                     | wxPython.wx.wxICONIZE \
                      | wxPython.wx.wxNO_FULL_REPAINT_ON_RESIZE)
-        try :             
-            self.tbicon = wxPython.wx.wxTaskBarIcon()
-        except AttributeError :    
-            self.tbicon = None # No taskbar icon facility, old wxWidgets maybe
-        
-        self.greenicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-green.ico"), \
-                                  wxPython.wx.wxBITMAP_TYPE_ICO)
-        self.redicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-red.ico"), \
-                                  wxPython.wx.wxBITMAP_TYPE_ICO)
-        
-        self.SetIcon(self.greenicon)
-        if self.tbicon is not None :
-            self.tbicon.SetIcon(self.greenicon, "PyKotIcon")
-            wxPython.wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate)
-            wxPython.wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu)
-        
-            self.TBMENU_RESTORE = wx.NewId()
-            self.TBMENU_CLOSE = wx.NewId()
-            wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \
-                                              self.OnTaskBarActivate)
-            wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \
-                                              self.OnTaskBarClose)
-            self.menu = wxPython.wx.wxMenu()
-            self.menu.Append(self.TBMENU_RESTORE, _("Show Print Quota"))
-            self.menu.Append(self.TBMENU_CLOSE, _("Quit"))
-        
+#        try :             
+#            self.tbicon = wxPython.wx.wxTaskBarIcon()
+#        except AttributeError :    
+#            self.tbicon = None # No taskbar icon facility, old wxWidgets maybe
+#        
+#        self.greenicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-green.ico"), \
+#                                  wxPython.wx.wxBITMAP_TYPE_ICO)
+#        self.redicon = wxPython.wx.wxIcon(os.path.join(iconsdir, "pykoticon-red.ico"), \
+#                                  wxPython.wx.wxBITMAP_TYPE_ICO)
+#        
+#        self.SetIcon(self.greenicon)
+#        if self.tbicon is not None :
+#            self.tbicon.SetIcon(self.greenicon, "PyKotIcon")
+#            wxPython.wx.EVT_TASKBAR_LEFT_DCLICK(self.tbicon, self.OnTaskBarActivate)
+#            wxPython.wx.EVT_TASKBAR_RIGHT_UP(self.tbicon, self.OnTaskBarMenu)
+#        
+#            self.TBMENU_RESTORE = wx.NewId()
+#            self.TBMENU_CLOSE = wx.NewId()
+#            wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_RESTORE, \
+#                                              self.OnTaskBarActivate)
+#            wxPython.wx.EVT_MENU(self.tbicon, self.TBMENU_CLOSE, \
+#                                              self.OnTaskBarClose)
+#            self.menu = wxPython.wx.wxMenu()
+#            self.menu.Append(self.TBMENU_RESTORE, _("Show Print Quota"))
+#            self.menu.Append(self.TBMENU_CLOSE, _("Quit"))
+#        
         wxPython.wx.EVT_ICONIZE(self, self.OnIconify)
         wxPython.wx.EVT_CLOSE(self, self.OnClose)
-        
-        self.closing = False
+        self.Show(True)
         
     def closeServer(self) :    
@@ -194,6 +201,6 @@
 
     def OnTaskBarActivate(self, event) :
-        if self.IsIconized() :
-            self.Iconize(False)
+        #if self.IsIconized() :
+        #    self.Iconize(False)
         if not self.IsShown() :
             self.Show(True)
@@ -212,17 +219,29 @@
         self.Destroy()
 
-    def OnTaskBarMenu(self, evt) :
-        if self.tbicon :
-            self.tbicon.PopupMenu(self.menu)
-
-    def OnTaskBarClose(self, evt) :
+    def OnTaskBarMenu(self, event) :
+        #if self.tbicon :
+        #    self.tbicon.PopupMenu(self.menu)
+        pass
+
+    def OnTaskBarClose(self, event) :
         self.Close()
+        
+    def askConfirmation(self, printername, username, jobid, jobtitle, jobsize) :
+        """Asks for confirmation before printing."""
+        message = _("""Hello %(username)s,
+        
+                     You sent job %(jobid)s (%(jobtitle)s) to printer %(printername)s.
+                                    
+                     This job seems to be %(jobsize)s pages long. 
+                                    
+                     Please confirm or cancel.""") % locals()
+                     
+        dialog = wx.MessageDialog(self, message, _("Confirmation"), wx.OK | wx.CANCEL)
+        self.askConfirmationResult = dialog.ShowModal()
+        dialog.Destroy()
 
 class PyKotIconApp(wx.PySimpleApp):
     def OnInit(self) :
-        try :
-            self.frame = PyKotIcon(None, -1)
-        except :    
-            crashed()
+        self.frame = PyKotIcon(None, -1)
         return True
         
