summaryrefslogtreecommitdiffstats
path: root/konversation/src/konversationmainwindow.h
blob: 7d37f5d636824fd5e3757b74f8a64ae924d93598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
*/

/*
  Copyright (C) 2002 Dario Abatianni <eisfuchs@tigress.com>
  Copyright (C) 2005 Ismail Donmez <ismail@kde.org>
  Copyright (C) 2005 Peter Simonsson <psn@linux.se>
  Copyright (C) 2005 John Tapsell <johnflux@gmail.com>
  Copyright (C) 2005-2008 Eike Hein <hein@kde.org>
*/

#ifndef _KONVERSATIONMAINWINDOW_H_
#define _KONVERSATIONMAINWINDOW_H_

#include "channel.h"
#include "config/preferences.h"
#include "ssllabel.h"
#include "nickinfo.h"
#include "server.h"

#include <tqstringlist.h>

#include <tdemainwindow.h>
#include <tdeaction.h>


class TDEToggleAction;
class KScriptManager;

class KonviBookmarkHandler;
class Ignore;
class NicksOnline;
class QuickButtonsDialog;
class KonviSettingsDialog;
class ViewContainer;
class KonversationStatusBar;

namespace Konversation
{
    class ServerListDialog;
    class TrayIcon;
}

class KonversationMainWindow : public TDEMainWindow
{
    Q_OBJECT
  

    public:
        KonversationMainWindow();
        ~KonversationMainWindow();

        ViewContainer* getViewContainer() { return m_viewContainer; }
        Konversation::TrayIcon* systemTrayIcon() const { return m_trayIcon; }

        /** Some errors need to be shown, even when konversation is minimized.
         *  For example, when a kimiface call is received to query a person,
         *  (e.g. the user choses "Chat with X" in kmail) but that person isn't
         *  recognised, we need to give immediate feedback to the user.
         */
        void focusAndShowErrorMessage(const TQString &errorMsg);

        TQString currentURL(bool passNetwork);
        TQString currentTitle();

    signals:
        void startNotifyTimer(int msec);
        void showQuickConnectDialog();
        void nicksNowOnline(Server*);
        void endNotification();
        void serverStateChanged(Server* server, Konversation::ConnectionState state);
        void triggerRememberLine();
        void triggerRememberLines(Server*);
        void cancelRememberLine();
        void insertMarkerLine();

    public slots:
        void updateTrayIcon();

        void openServerList();

        void openIdentitiesDialog();
        IdentityPtr editIdentity(IdentityPtr identity);

        void setOnlineList(Server* notifyServer,const TQStringList& list, bool changed);

    protected slots:
        /** This is connected to the preferences settingsChanged signal and acts to compress
        *  multiple successively settingsChanged() signals into a single output
        *  appearanceChanged() signal.
        *
        *  Do not connect to the settingsChanged signal elsewhere.  If you want to know when
        *  the settings have changed, connect to:
        *  KonversationApplication::instance(), TQT_SIGNAL(appearanceChanged())
        */
        void settingsChangedSlot();

        /** This is connected to the appearanceChanged signal.
        *  @see settingsChangedSlot()
        */
        void resetHasDirtySettings();

        void toggleMenubar(bool dontShowWarning = false);

        int configureToolbar();
        void saveToolbarConfig();

        void openPrefsDialog();
        void openKeyBindings();
        void openQuickConnectDialog();

        void openNotify();
        // it seems that moc does not honor #ifs in compile so we create an
        // empty slot in our .cpp file rather than #if this slot out
        void openNotifications();
        void notifyAction(const TQString& serverName,const TQString& nick);

        void quitProgram();
        void showEvent(TQShowEvent* e);
        void hideEvent(TQHideEvent* e);
        void leaveEvent(TQEvent* e);
        

    protected:
        int confirmQuit();
        bool queryClose();
        virtual bool event(TQEvent* e);

        ViewContainer* m_viewContainer;
        KonversationStatusBar* m_statusBar;
        Konversation::TrayIcon* m_trayIcon;

        TDEToggleAction* hideMenuBarAction;

        TDEPopupMenu* m_bookmarks;
        KonviBookmarkHandler* m_bookmarkHandler;
        KonviSettingsDialog *m_settingsDialog;
        Konversation::ServerListDialog* m_serverListDialog;

        /** @see settingsChangedSlot() */
        bool m_hasDirtySettings;
        bool m_closeApp;
};

#endif