Changeset View
Changeset View
Standalone View
Standalone View
src/configdialog/dialogs/DatabaseConfig.cpp
Show All 34 Lines | 32 | { | |||
---|---|---|---|---|---|
35 | // Fix some weird tab orderness | 35 | // Fix some weird tab orderness | ||
36 | setTabOrder( kcfg_Host, kcfg_Port ); // host to port | 36 | setTabOrder( kcfg_Host, kcfg_Port ); // host to port | ||
37 | setTabOrder( kcfg_Port, kcfg_User ); // port to username | 37 | setTabOrder( kcfg_Port, kcfg_User ); // port to username | ||
38 | setTabOrder( kcfg_User, kcfg_Password ); // username to password | 38 | setTabOrder( kcfg_User, kcfg_Password ); // username to password | ||
39 | setTabOrder( kcfg_Password, kcfg_Database ); // password to database | 39 | setTabOrder( kcfg_Password, kcfg_Database ); // password to database | ||
40 | 40 | | |||
41 | // enable the test button if one of the plugin factories has a correct testSettings slot | 41 | // enable the test button if one of the plugin factories has a correct testSettings slot | ||
42 | // get all storage factories | 42 | // get all storage factories | ||
43 | QList<Plugins::PluginFactory*> factories; | 43 | auto factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); | ||
44 | factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); | | |||
45 | bool testFunctionAvailable = false; | 44 | bool testFunctionAvailable = false; | ||
46 | foreach( Plugins::PluginFactory* factory, factories ) | 45 | for( const auto &factory : factories ) | ||
47 | { | 46 | { | ||
48 | // check the meta object if there is a testSettings slot available | 47 | // check the meta object if there is a testSettings slot available | ||
49 | if( factory->metaObject()-> | 48 | if( factory->metaObject()-> | ||
50 | indexOfMethod( QMetaObject::normalizedSignature("testSettings(QString, QString, QString, int, QString)" ) ) >= 0 ) | 49 | indexOfMethod( QMetaObject::normalizedSignature("testSettings(QString, QString, QString, int, QString)" ) ) >= 0 ) | ||
51 | testFunctionAvailable = true; | 50 | testFunctionAvailable = true; | ||
52 | } | 51 | } | ||
53 | button_Test->setEnabled( testFunctionAvailable ); | 52 | button_Test->setEnabled( testFunctionAvailable ); | ||
54 | 53 | | |||
Show All 19 Lines | |||||
74 | { | 73 | { | ||
75 | group_Connection->setEnabled( checkBoxState == Qt::Checked ); | 74 | group_Connection->setEnabled( checkBoxState == Qt::Checked ); | ||
76 | } | 75 | } | ||
77 | 76 | | |||
78 | void | 77 | void | ||
79 | DatabaseConfig::testDatabaseConnection() //SLOT | 78 | DatabaseConfig::testDatabaseConnection() //SLOT | ||
80 | { | 79 | { | ||
81 | // get all storage factories | 80 | // get all storage factories | ||
82 | QList<Plugins::PluginFactory*> factories; | 81 | auto factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); | ||
83 | factories = Plugins::PluginManager::instance()->factories( Plugins::PluginManager::Storage ); | | |||
84 | 82 | | |||
85 | // try if they have a testSettings slot that we can call | 83 | // try if they have a testSettings slot that we can call | ||
86 | foreach( Plugins::PluginFactory* factory, factories ) | 84 | for( const auto &factory : factories ) | ||
87 | { | 85 | { | ||
88 | bool callSucceeded = false; | 86 | bool callSucceeded = false; | ||
89 | QStringList connectionErrors; | 87 | QStringList connectionErrors; | ||
90 | 88 | | |||
91 | callSucceeded = QMetaObject::invokeMethod( factory, | 89 | callSucceeded = QMetaObject::invokeMethod( factory.data(), | ||
92 | "testSettings", | 90 | "testSettings", | ||
93 | Q_RETURN_ARG( QStringList, connectionErrors ), | 91 | Q_RETURN_ARG( QStringList, connectionErrors ), | ||
94 | Q_ARG( QString, kcfg_Host->text() ), | 92 | Q_ARG( QString, kcfg_Host->text() ), | ||
95 | Q_ARG( QString, kcfg_User->text() ), | 93 | Q_ARG( QString, kcfg_User->text() ), | ||
96 | Q_ARG( QString, kcfg_Password->text() ), | 94 | Q_ARG( QString, kcfg_Password->text() ), | ||
97 | Q_ARG( int, kcfg_Port->text().toInt() ), | 95 | Q_ARG( int, kcfg_Port->text().toInt() ), | ||
98 | Q_ARG( QString, kcfg_Database->text() ) | 96 | Q_ARG( QString, kcfg_Database->text() ) | ||
99 | ); | 97 | ); | ||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |