src/*: mark methods const when possible and semantically sensible

parent 9083cc60
......@@ -1124,7 +1124,7 @@ NickInfoPtr Application::getNickInfo(const QString &ircnick, const QString &serv
}
// auto replace on input/output
QPair<QString, int> Application::doAutoreplace(const QString& text, bool output, int cursorPos)
QPair<QString, int> Application::doAutoreplace(const QString& text, bool output, int cursorPos) const
{
// get autoreplace list
QList<QStringList> autoreplaceList=Preferences::autoreplaceList();
......@@ -1254,7 +1254,7 @@ QPair<QString, int> Application::doAutoreplace(const QString& text, bool output,
return QPair<QString, int>(line, cursorPos);
}
void Application::doInlineAutoreplace(KTextEdit* textEdit)
void Application::doInlineAutoreplace(KTextEdit* textEdit) const
{
QTextCursor cursor(textEdit->document());
......@@ -1300,7 +1300,7 @@ void Application::openUrl(const QString& url)
}
}
Konversation::Sound* Application::sound()
Konversation::Sound* Application::sound() const
{
if (!m_sound)
m_sound = new Konversation::Sound;
......
......@@ -73,18 +73,18 @@ class Application : public QApplication
* Note to any MDI developer - get this to return any of the windows, or some
* 'main' one.
*/
MainWindow* getMainWindow() { return mainWindow; }
MainWindow* getMainWindow() const { return mainWindow; }
ConnectionManager* getConnectionManager() { return m_connectionManager; }
AwayManager* getAwayManager() { return m_awayManager; }
ScriptLauncher* getScriptLauncher() { return m_scriptLauncher; }
Konversation::DCC::TransferManager* getDccTransferManager() { return m_dccTransferManager; }
ConnectionManager* getConnectionManager() const { return m_connectionManager; }
AwayManager* getAwayManager() const { return m_awayManager; }
ScriptLauncher* getScriptLauncher() const { return m_scriptLauncher; }
Konversation::DCC::TransferManager* getDccTransferManager() const { return m_dccTransferManager; }
// HACK
void showQueueTuner(bool);
// URL-Catcher
QStandardItemModel* getUrlModel() { return m_urlModel; }
QStandardItemModel* getUrlModel() const { return m_urlModel; }
Application(int &argc, char **argv);
~Application() override;
......@@ -113,19 +113,19 @@ class Application : public QApplication
OSDWidget* osd;
Konversation::Sound* sound();
Konversation::Sound* sound() const;
IRCQueue::EmptyingRate staticrates[Server::_QueueListSize];
Images* images() { return m_images; }
Images* images() const { return m_images; }
Konversation::NotificationHandler* notificationHandler() const { return m_notificationHandler; }
// auto replacement for input or output lines
QPair<QString, int> doAutoreplace(const QString& text, bool output, int cursorPos = -1);
QPair<QString, int> doAutoreplace(const QString& text, bool output, int cursorPos = -1) const;
// inline auto replacement for input lines
void doInlineAutoreplace(KTextEdit* textEdit);
void doInlineAutoreplace(KTextEdit* textEdit) const;
void newInstance(QCommandLineParser *args);
......@@ -188,7 +188,7 @@ class Application : public QApplication
Konversation::DBus* dbusObject;
Konversation::IdentDBus* identDBus;
QPointer<MainWindow> mainWindow;
Konversation::Sound* m_sound;
mutable Konversation::Sound* m_sound;
QuickConnectDialog* quickConnectDialog;
Images* m_images;
bool m_restartScheduled;
......
......@@ -644,7 +644,7 @@ QList<Server*> ConnectionManager::getServerList() const
return serverList;
}
Server* ConnectionManager::getServerByConnectionId(int connectionId)
Server* ConnectionManager::getServerByConnectionId(int connectionId) const
{
if (m_connectionList.contains(connectionId))
return m_connectionList[connectionId];
......@@ -652,7 +652,7 @@ Server* ConnectionManager::getServerByConnectionId(int connectionId)
return nullptr;
}
Server* ConnectionManager::getServerByName(const QString& name, NameMatchFlags flags)
Server* ConnectionManager::getServerByName(const QString& name, NameMatchFlags flags) const
{
if (flags == MatchByIdThenName)
{
......
......@@ -40,8 +40,8 @@ class ConnectionManager : public QObject
MatchByIdThenName
};
Server* getServerByConnectionId(int connectionId);
Server* getServerByName(const QString& name, NameMatchFlags flags = MatchByName);
Server* getServerByConnectionId(int connectionId) const;
Server* getServerByName(const QString& name, NameMatchFlags flags = MatchByName) const;
public Q_SLOTS:
......
......@@ -18,7 +18,7 @@ ConnectionSettings::ConnectionSettings()
m_reconnectCount = 0;
}
bool ConnectionSettings::isValid()
bool ConnectionSettings::isValid() const
{
if (m_server.host().isEmpty()) return false;
......
......@@ -23,7 +23,7 @@ class ConnectionSettings
public:
explicit ConnectionSettings();
bool isValid();
bool isValid() const;
QString name() const;
......
......@@ -93,7 +93,7 @@ KonsolePanel::~KonsolePanel()
}
}
QWidget* KonsolePanel::getWidget()
QWidget* KonsolePanel::getWidget() const
{
if (k_part)
return k_part->widget();
......
......@@ -31,7 +31,7 @@ class KonsolePanel : public ChatWindow
void setName(const QString& newName) override { ChatWindow::setName(newName); }
QWidget* getWidget();
QWidget* getWidget() const;
Q_SIGNALS:
void closeView(ChatWindow* view);
......
......@@ -47,7 +47,7 @@ class MainWindow : public KXmlGuiWindow
MainWindow();
~MainWindow() override;
ViewContainer* getViewContainer() { return m_viewContainer; }
ViewContainer* getViewContainer() const { return m_viewContainer; }
Konversation::TrayIcon* systemTrayIcon() const { return m_trayIcon; }
/** Some errors need to be shown, even when konversation is minimized.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment