Changeset View
Changeset View
Standalone View
Standalone View
addons/katesql/katesqlview.cpp
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 58 | { | |||
---|---|---|---|---|---|
84 | 84 | | |||
85 | m_mainWindow->guiFactory()->addClient(this); | 85 | m_mainWindow->guiFactory()->addClient(this); | ||
86 | 86 | | |||
87 | QMenu *sqlMenu = (QMenu*)factory()->container(QLatin1String ("SQL"), this); | 87 | QMenu *sqlMenu = (QMenu*)factory()->container(QLatin1String ("SQL"), this); | ||
88 | 88 | | |||
89 | m_connectionsGroup = new QActionGroup(sqlMenu); | 89 | m_connectionsGroup = new QActionGroup(sqlMenu); | ||
90 | m_connectionsGroup->setExclusive(true); | 90 | m_connectionsGroup->setExclusive(true); | ||
91 | 91 | | |||
92 | connect(sqlMenu, SIGNAL(aboutToShow()), this, SLOT(slotSQLMenuAboutToShow())); | 92 | connect(sqlMenu, &QMenu::aboutToShow, this, &KateSQLView::slotSQLMenuAboutToShow); | ||
93 | connect(m_connectionsGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotConnectionSelectedFromMenu(QAction*))); | 93 | connect(m_connectionsGroup, &QActionGroup::triggered, this, &KateSQLView::slotConnectionSelectedFromMenu); | ||
94 | 94 | connect(m_manager, &SQLManager::error, this, &KateSQLView::slotError); | |||
95 | connect(m_manager, SIGNAL(error(QString)), this, SLOT(slotError(QString))); | 95 | connect(m_manager, &SQLManager::success, this, &KateSQLView::slotSuccess); | ||
96 | connect(m_manager, SIGNAL(success(QString)), this, SLOT(slotSuccess(QString))); | 96 | connect(m_manager, &SQLManager::queryActivated, this, &KateSQLView::slotQueryActivated); | ||
97 | connect(m_manager, SIGNAL(queryActivated(QSqlQuery&,QString)), this, SLOT(slotQueryActivated(QSqlQuery&,QString))); | 97 | connect(m_manager, &SQLManager::connectionCreated, this, &KateSQLView::slotConnectionCreated); | ||
98 | connect(m_manager, SIGNAL(connectionCreated(QString)), this, SLOT(slotConnectionCreated(QString))); | 98 | connect(m_manager, &SQLManager::connectionAboutToBeClosed, this, &KateSQLView::slotConnectionAboutToBeClosed); | ||
99 | connect(m_manager, SIGNAL(connectionAboutToBeClosed(QString)), this, SLOT(slotConnectionAboutToBeClosed(QString))); | 99 | connect(m_connectionsComboBox, static_cast<void (KComboBox::*)(const QString &)>(&KComboBox::currentIndexChanged), this, &KateSQLView::slotConnectionChanged); | ||
100 | connect(m_connectionsComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotConnectionChanged(QString))); | | |||
101 | 100 | | |||
102 | stateChanged(QLatin1String ("has_connection_selected"), KXMLGUIClient::StateReverse); | 101 | stateChanged(QLatin1String ("has_connection_selected"), KXMLGUIClient::StateReverse); | ||
103 | } | 102 | } | ||
104 | 103 | | |||
105 | 104 | | |||
106 | KateSQLView::~KateSQLView() | 105 | KateSQLView::~KateSQLView() | ||
107 | { | 106 | { | ||
108 | m_mainWindow->guiFactory()->removeClient( this ); | 107 | m_mainWindow->guiFactory()->removeClient( this ); | ||
109 | 108 | | |||
110 | delete m_outputToolView; | 109 | delete m_outputToolView; | ||
111 | delete m_schemaBrowserToolView; | 110 | delete m_schemaBrowserToolView; | ||
112 | 111 | | |||
113 | delete m_manager; | 112 | delete m_manager; | ||
114 | } | 113 | } | ||
115 | 114 | | |||
116 | 115 | | |||
117 | void KateSQLView::setupActions() | 116 | void KateSQLView::setupActions() | ||
118 | { | 117 | { | ||
119 | QAction* action; | 118 | QAction* action; | ||
120 | KActionCollection* collection = actionCollection(); | 119 | KActionCollection* collection = actionCollection(); | ||
121 | 120 | | |||
122 | action = collection->addAction(QLatin1String ("connection_create")); | 121 | action = collection->addAction(QLatin1String ("connection_create")); | ||
123 | action->setText( i18nc("@action:inmenu", "Add connection...") ); | 122 | action->setText( i18nc("@action:inmenu", "Add connection...") ); | ||
124 | action->setIcon( QIcon::fromTheme (QLatin1String ("list-add")) ); | 123 | action->setIcon( QIcon::fromTheme (QLatin1String ("list-add")) ); | ||
125 | connect( action , SIGNAL(triggered()) , this , SLOT(slotConnectionCreate()) ); | 124 | connect(action, &QAction::triggered, this, &KateSQLView::slotConnectionCreate); | ||
126 | 125 | | |||
127 | action = collection->addAction(QLatin1String ("connection_remove")); | 126 | action = collection->addAction(QLatin1String ("connection_remove")); | ||
128 | action->setText( i18nc("@action:inmenu", "Remove connection") ); | 127 | action->setText( i18nc("@action:inmenu", "Remove connection") ); | ||
129 | action->setIcon( QIcon::fromTheme (QLatin1String ("list-remove")) ); | 128 | action->setIcon( QIcon::fromTheme (QLatin1String ("list-remove")) ); | ||
130 | connect( action , SIGNAL(triggered()) , this , SLOT(slotConnectionRemove()) ); | 129 | connect(action, &QAction::triggered, this, &KateSQLView::slotConnectionRemove); | ||
131 | 130 | | |||
132 | action = collection->addAction(QLatin1String ("connection_edit")); | 131 | action = collection->addAction(QLatin1String ("connection_edit")); | ||
133 | action->setText( i18nc("@action:inmenu", "Edit connection...") ); | 132 | action->setText( i18nc("@action:inmenu", "Edit connection...") ); | ||
134 | action->setIcon( QIcon::fromTheme (QLatin1String ("configure")) ); | 133 | action->setIcon( QIcon::fromTheme (QLatin1String ("configure")) ); | ||
135 | connect( action , SIGNAL(triggered()) , this , SLOT(slotConnectionEdit()) ); | 134 | connect(action, &QAction::triggered, this, &KateSQLView::slotConnectionEdit); | ||
136 | 135 | | |||
137 | action = collection->addAction(QLatin1String ("connection_reconnect")); | 136 | action = collection->addAction(QLatin1String ("connection_reconnect")); | ||
138 | action->setText( i18nc("@action:inmenu", "Reconnect") ); | 137 | action->setText( i18nc("@action:inmenu", "Reconnect") ); | ||
139 | action->setIcon( QIcon::fromTheme (QLatin1String ("view-refresh")) ); | 138 | action->setIcon( QIcon::fromTheme (QLatin1String ("view-refresh")) ); | ||
140 | connect( action , SIGNAL(triggered()) , this , SLOT(slotConnectionReconnect()) ); | 139 | connect(action, &QAction::triggered, this, &KateSQLView::slotConnectionReconnect); | ||
141 | 140 | | |||
142 | QWidgetAction *wa = new QWidgetAction(this); | 141 | QWidgetAction *wa = new QWidgetAction(this); | ||
143 | collection->addAction(QLatin1String ("connection_chooser"), wa); | 142 | collection->addAction(QLatin1String ("connection_chooser"), wa); | ||
144 | wa->setText( i18nc("@action:intoolbar", "Connection") ); | 143 | wa->setText( i18nc("@action:intoolbar", "Connection") ); | ||
145 | wa->setDefaultWidget(m_connectionsComboBox); | 144 | wa->setDefaultWidget(m_connectionsComboBox); | ||
146 | 145 | | |||
147 | action = collection->addAction(QLatin1String ("query_run")); | 146 | action = collection->addAction(QLatin1String ("query_run")); | ||
148 | action->setText( i18nc("@action:inmenu", "Run query") ); | 147 | action->setText( i18nc("@action:inmenu", "Run query") ); | ||
149 | action->setIcon( QIcon::fromTheme (QLatin1String ("quickopen")) ); | 148 | action->setIcon( QIcon::fromTheme (QLatin1String ("quickopen")) ); | ||
150 | collection->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_E) ); | 149 | collection->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_E) ); | ||
151 | connect( action , SIGNAL(triggered()) , this , SLOT(slotRunQuery())); | 150 | connect(action, &QAction::triggered, this, &KateSQLView::slotRunQuery); | ||
152 | 151 | | |||
153 | /// TODO: stop sql query | 152 | /// TODO: stop sql query | ||
154 | // action = collection->addAction("sql_stop"); | 153 | // action = collection->addAction("sql_stop"); | ||
155 | // action->setText( i18n("Stop query") ); | 154 | // action->setText( i18n("Stop query") ); | ||
156 | // action->setIcon( KIcon("process-stop") ); | 155 | // action->setIcon( KIcon("process-stop") ); | ||
157 | // action->setShortcut( QKeySequence(Qt::ALT + Qt::Key_F5) ); | 156 | // action->setShortcut( QKeySequence(Qt::ALT + Qt::Key_F5) ); | ||
158 | // connect( action , SIGNAL(triggered()) , this , SLOT(stopQuery())); | 157 | // connect( action , SIGNAL(triggered()) , this , SLOT(stopQuery())); | ||
159 | } | 158 | } | ||
▲ Show 20 Lines • Show All 233 Lines • Show Last 20 Lines |