source: trunk/dsa_messenger/client-main_windows.adb

Last change on this file was 14, checked in by vadim.godunko, 12 years ago

Add handling of failed logon procedure.

File size: 1.9 KB
Line 
1with Qt4.Message_Boxes;
2with Qt4.Objects;
3
4with Server.Logon_Manager;
5with Client.Main_Windows.Moc;
6
7package body Client.Main_Windows is
8
9 function "-" (Item : String) return Qt4.Strings.Q_String
10 renames Qt4.Strings.From_Utf_8;
11
12 ------------------
13 -- Constructors --
14 ------------------
15
16 package body Constructors is
17
18 ------------
19 -- Create --
20 ------------
21
22 function Create
23 (Session : not null access Client.Sessions.Session)
24 return not null Main_Window_Access is
25 begin
26 return Self : not null Main_Window_Access := new Main_Window do
27 Qt4.Main_Windows.Directors.Constructors.Initialize (Self);
28 Self.CI :=
29 Messenger.Client_Sessions.Client_Session_Access (Session);
30 Self.Logon := Logon_Dialogs.Constructors.Create (Self);
31 Qt4.Objects.Connect
32 (Self.Logon,
33 Qt4.Signal ("accepted(QString,QString)"),
34 Self,
35 Qt4.Slot ("logon(QString,QString)"));
36
37 Self.Chat := Chat_Windows.Constructors.Create;
38 Self.Set_Central_Widget (Self.Chat);
39
40 Client.Sessions.Session'Class
41 (Session.all).Set_Message_Dispatcher (Self.Chat);
42
43 Self.Logon.Show;
44 end return;
45 end Create;
46
47 end Constructors;
48
49 -----------
50 -- Logon --
51 -----------
52
53 procedure Logon
54 (Self : not null access Main_Window'Class;
55 Login : Qt4.Strings.Q_String;
56 Password : Qt4.Strings.Q_String)
57 is
58 Aux : Qt4.Message_Boxes.Standard_Button;
59
60 begin
61 Server.Logon_Manager.Logon (Login.To_Utf_8, Password.To_Utf_8, Self.CI);
62
63 exception
64 when Messenger.Logon_Failed =>
65 Aux :=
66 Qt4.Message_Boxes.Critical
67 (Self,
68 -"Logon failed",
69 -"Logon failed, please verify login and password");
70 Self.Logon.Show;
71 end Logon;
72
73end Client.Main_Windows;
Note: See TracBrowser for help on using the repository browser.