53 url = QUrl(connection, QUrl.TolerantMode) |
54 url = QUrl(connection, QUrl.TolerantMode) |
54 if not url.isValid(): |
55 if not url.isValid(): |
55 self.__warnings.append(self.trUtf8("Invalid URL: {0}").format(connection)) |
56 self.__warnings.append(self.trUtf8("Invalid URL: {0}").format(connection)) |
56 continue |
57 continue |
57 |
58 |
58 err = self.__browser.addConnection(url.scheme(), url.path(), |
59 err = self.__browser.addConnection(url.scheme(), url.path(), |
59 url.userName(), url.password(), |
60 url.userName(), url.password(), |
60 url.host(), url.port(-1)) |
61 url.host(), url.port(-1)) |
61 if err.type() != QSqlError.NoError: |
62 if err.type() != QSqlError.NoError: |
62 self.__warnings.append( |
63 self.__warnings.append( |
63 self.trUtf8("Unable to open connection: {0}".format(err.text()))) |
64 self.trUtf8("Unable to open connection: {0}".format(err.text()))) |
64 |
65 |
81 Private method to define the user interface actions. |
82 Private method to define the user interface actions. |
82 """ |
83 """ |
83 # list of all actions |
84 # list of all actions |
84 self.__actions = [] |
85 self.__actions = [] |
85 |
86 |
86 self.addConnectionAct = E5Action(self.trUtf8('Add Connection'), |
87 self.addConnectionAct = E5Action(self.trUtf8('Add Connection'), |
87 UI.PixmapCache.getIcon("databaseConnection.png"), |
88 UI.PixmapCache.getIcon("databaseConnection.png"), |
88 self.trUtf8('Add &Connection...'), |
89 self.trUtf8('Add &Connection...'), |
89 0, 0, self, 'sql_file_add_connection') |
90 0, 0, self, 'sql_file_add_connection') |
90 self.addConnectionAct.setStatusTip(self.trUtf8( |
91 self.addConnectionAct.setStatusTip(self.trUtf8( |
91 'Open a dialog to add a new database connection')) |
92 'Open a dialog to add a new database connection')) |
92 self.addConnectionAct.setWhatsThis(self.trUtf8( |
93 self.addConnectionAct.setWhatsThis(self.trUtf8( |
93 """<b>Add Connection</b>""" |
94 """<b>Add Connection</b>""" |
94 """<p>This opens a dialog to add a new database connection.</p>""" |
95 """<p>This opens a dialog to add a new database connection.</p>""" |
95 )) |
96 )) |
96 self.addConnectionAct.triggered[()].connect(self.__browser.addConnectionByDialog) |
97 self.addConnectionAct.triggered[()].connect(self.__browser.addConnectionByDialog) |
97 self.__actions.append(self.addConnectionAct) |
98 self.__actions.append(self.addConnectionAct) |
98 |
99 |
99 self.exitAct = E5Action(self.trUtf8('Quit'), |
100 self.exitAct = E5Action(self.trUtf8('Quit'), |
100 UI.PixmapCache.getIcon("exit.png"), |
101 UI.PixmapCache.getIcon("exit.png"), |
101 self.trUtf8('&Quit'), |
102 self.trUtf8('&Quit'), |
102 QKeySequence(self.trUtf8("Ctrl+Q","File|Quit")), |
103 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit")), |
103 0, self, 'sql_file_quit') |
104 0, self, 'sql_file_quit') |
104 self.exitAct.setStatusTip(self.trUtf8('Quit the SQL browser')) |
105 self.exitAct.setStatusTip(self.trUtf8('Quit the SQL browser')) |
105 self.exitAct.setWhatsThis(self.trUtf8( |
106 self.exitAct.setWhatsThis(self.trUtf8( |
106 """<b>Quit</b>""" |
107 """<b>Quit</b>""" |
107 """<p>Quit the SQL browser.</p>""" |
108 """<p>Quit the SQL browser.</p>""" |
108 )) |
109 )) |
109 self.exitAct.triggered[()].connect(qApp.closeAllWindows) |
110 self.exitAct.triggered[()].connect(qApp.closeAllWindows) |
110 |
111 |
111 self.aboutAct = E5Action(self.trUtf8('About'), |
112 self.aboutAct = E5Action(self.trUtf8('About'), |
112 self.trUtf8('&About'), |
113 self.trUtf8('&About'), |
113 0, 0, self, 'sql_help_about') |
114 0, 0, self, 'sql_help_about') |
114 self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) |
115 self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) |
115 self.aboutAct.setWhatsThis(self.trUtf8( |
116 self.aboutAct.setWhatsThis(self.trUtf8( |
116 """<b>About</b>""" |
117 """<b>About</b>""" |
117 """<p>Display some information about this software.</p>""" |
118 """<p>Display some information about this software.</p>""" |
118 )) |
119 )) |
119 self.aboutAct.triggered[()].connect(self.__about) |
120 self.aboutAct.triggered[()].connect(self.__about) |
120 self.__actions.append(self.aboutAct) |
121 self.__actions.append(self.aboutAct) |
121 |
122 |
122 self.aboutQtAct = E5Action(self.trUtf8('About Qt'), |
123 self.aboutQtAct = E5Action(self.trUtf8('About Qt'), |
123 self.trUtf8('About &Qt'), |
124 self.trUtf8('About &Qt'), |
124 0, 0, self, 'sql_help_about_qt') |
125 0, 0, self, 'sql_help_about_qt') |
125 self.aboutQtAct.setStatusTip( |
126 self.aboutQtAct.setStatusTip( |
126 self.trUtf8('Display information about the Qt toolkit')) |
127 self.trUtf8('Display information about the Qt toolkit')) |
127 self.aboutQtAct.setWhatsThis(self.trUtf8( |
128 self.aboutQtAct.setWhatsThis(self.trUtf8( |
128 """<b>About Qt</b>""" |
129 """<b>About Qt</b>""" |