~ubuntu-branches/ubuntu/natty/qtnx/natty

« back to all changes in this revision

Viewing changes to debian/patches/autoconnect-status-handling

  • Committer: Stéphane Graber
  • Date: 2011-03-20 22:08:37 UTC
  • Revision ID: stgraber@ubuntu.com-20110320220837-6t1akh00t9q7pg4o
Tags: 0.9-3ubuntu4
releasing version 0.9-3ubuntu4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== modified file 'qtnxwindow.cpp'
 
2
--- qtnx1/qtnxwindow.cpp        2011-03-20 21:51:32 +0000
 
3
+++ qtnx/qtnxwindow.cpp 2011-03-20 22:01:51 +0000
 
4
@@ -30,6 +30,7 @@
 
5
 
 
6
 using namespace nxcl;
 
7
 using namespace std;
 
8
+bool no_ui = 0;
 
9
 
 
10
 QtNXWindow::QtNXWindow() :
 
11
     QMainWindow(),
 
12
@@ -251,6 +252,7 @@
 
13
         show();
 
14
     }
 
15
     else {
 
16
+        no_ui=1;
 
17
         startConnect();
 
18
     }
 
19
 }
 
20
@@ -498,20 +500,40 @@
 
21
             handleStatus(tr("Process started"));
 
22
             break;
 
23
         case NXCL_PROCESS_EXITED:
 
24
-            handleStatus(tr("Process exited"));
 
25
+            if (no_ui == 0) {
 
26
+                handleStatus(tr("Process exited"));
 
27
+            }
 
28
+            else {
 
29
+                exit(0);
 
30
+            }
 
31
             break;
 
32
         case NXCL_AUTH_FAILED:
 
33
-            handleStatus(tr("Invalid authentication key"));
 
34
+            if (no_ui == 0) {
 
35
+                handleStatus(tr("Invalid authentication key"));
 
36
+            }
 
37
+            else {
 
38
+                exit(1);
 
39
+            }
 
40
             break;
 
41
         case NXCL_AUTHENTICATING:
 
42
             handleStatus(tr("Authenticating client"));
 
43
             break;
 
44
         case NXCL_LOGIN_FAILED:
 
45
-            handleStatus(tr("Invalid username or password"));
 
46
-            failedLogin();
 
47
+            if (no_ui == 0) {
 
48
+                handleStatus(tr("Invalid username or password"));
 
49
+                failedLogin();
 
50
+            }
 
51
+            else {
 
52
+                exit(1);
 
53
+            }
 
54
             break;
 
55
         case NXCL_HOST_KEY_VERIFAILED:
 
56
-            handleStatus(tr("Host key verification failed"));
 
57
+            if (no_ui == 0) {
 
58
+                handleStatus(tr("Host key verification failed"));
 
59
+            }
 
60
+            else {
 
61
+                exit(1);
 
62
+            }
 
63
             break;
 
64
         case NXCL_INVOKE_PROXY:
 
65
             handleStatus(tr("Starting NX proxy"));
 
66
@@ -526,7 +548,12 @@
 
67
             handleStatus(tr("NX session active"));
 
68
             break;
 
69
         case NXCL_PROCESS_ERROR:
 
70
-            handleStatus(tr("Process error"));
 
71
+            if (no_ui == 0) {
 
72
+                handleStatus(tr("Process error"));
 
73
+            }
 
74
+            else {
 
75
+                exit(1);
 
76
+            }
 
77
             break;
 
78
         default:
 
79
             break;
 
80