KVIrc  4.9.2
DeveloperAPIs
libkviurl.h
Go to the documentation of this file.
1 #ifndef _H_URLDLG
2 #define _H_URLDLG
3 //=============================================================================
4 //
5 // File : libkviurl.h
6 // Creation date : 1999 Andrea Parella
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 1999-2008 Andrea Parrella (yap@kvirc.net)
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "KviLocale.h"
28 #include "KviConfigurationFile.h"
29 #include "KviIrcToolBar.h"
30 #include "KviWindow.h"
31 #include "KviTalMenuBar.h"
32 #include "KviMexToolBar.h"
33 #include "KviKvsAction.h"
34 #include <QTreeWidget>
35 
36 #include <QDialog>
37 #include <QLayout>
38 #include <QString>
39 #include <QPushButton>
40 #include <QFile>
41 #include <QMenuBar>
42 #include <QInputDialog>
43 #include <QIcon>
44 #include <QPixmap>
45 #include <QCheckBox>
46 #include <QListWidget>
47 
48 typedef struct _KviUrl
49 {
50  QString url;
51  QString window;
52  int count;
53  QString timestamp;
54 } KviUrl;
55 
56 class UrlDialogTreeWidget : public QTreeWidget
57 {
58  Q_OBJECT
59 public:
60  UrlDialogTreeWidget(QWidget *);
62 
63 protected:
64  void mousePressEvent(QMouseEvent * e);
65  void paintEvent(QPaintEvent * event);
66 signals:
67  void rightButtonPressed(QTreeWidgetItem *, QPoint);
68  void contextMenuRequested(QPoint);
69 };
70 
71 class UrlDialog : public KviWindow
72 {
73  Q_OBJECT
74 public:
76  ~UrlDialog();
77 
78 private:
80  QMenu * m_pListPopup; // dynamic popup menu
81  QString m_szUrl; // used to pass URLs to sayToWin slot
82 protected:
83  QPixmap * myIconPtr();
84  void resizeEvent(QResizeEvent *);
85 
86 public:
88  void addUrl(QString url, QString window, QString count, QString timestamp);
89  // void saveProperties();
90 protected slots:
91  void config();
92  void help();
93  void saveList();
94  void loadList();
95  void clear();
96  void close_slot();
97  void remove();
98  void findtext();
99  void dblclk_url(QTreeWidgetItem * item, int);
100  void popup(QTreeWidgetItem * item, const QPoint & p);
101  void contextMenu(const QPoint & p);
102  void sayToWin(QAction * act);
103 };
104 
105 class BanFrame : public QFrame
106 {
107  Q_OBJECT
108 public:
109  BanFrame(QWidget * parent = 0, const char * name = 0, bool banEnable = false);
110  ~BanFrame();
111  void saveBans(KviConfigurationFile * cfg);
112 
113 private:
114  QCheckBox * m_pEnable;
115  QListWidget * m_pBanList;
116  QPushButton * m_pAddBtn;
117  QPushButton * m_pRemoveBtn;
118 protected slots:
119  void enableClicked();
120  void addBan();
121  void removeBan();
122 };
123 
124 #define cbnum 2
125 
126 class ConfigDialog : public QDialog
127 {
128  Q_OBJECT
129 public:
130  ConfigDialog();
131  ~ConfigDialog();
132 
133 private:
134  QCheckBox * cb[cbnum];
136  void closeEvent(QCloseEvent *);
137 protected slots:
138  void acceptbtn();
139  void discardbtn();
140 };
141 
142 #endif
Toolkit Abstraction Layer class.
void contextMenu(const QPoint &p)
Definition: libkviurl.cpp:252
void dblclk_url(QTreeWidgetItem *item, int)
Definition: libkviurl.cpp:222
KVIrc localization stuff.
BanFrame * m_pBanFrame
Definition: libkviurl.h:135
void contextMenuRequested(QPoint)
QPushButton * m_pRemoveBtn
Definition: libkviurl.h:117
~UrlDialog()
Definition: libkviurl.cpp:310
void removeBan()
Definition: libkviurl.cpp:454
Definition: libkviurl.h:105
Definition: libkviurl.h:56
void saveBans(KviConfigurationFile *cfg)
Definition: libkviurl.cpp:478
~UrlDialogTreeWidget()
Definition: libkviurl.h:61
UrlDialogTreeWidget * m_pUrlList
Definition: libkviurl.h:87
Definition: KviConfigurationFile.h:48
void findtext()
Definition: libkviurl.cpp:218
QString url
Definition: libkviurl.h:50
void paintEvent(QPaintEvent *event)
Definition: libkviurl.cpp:101
void addUrl(QString url, QString window, QString count, QString timestamp)
Definition: libkviurl.cpp:283
#define e
Definition: detector.cpp:69
QMenu * m_pListPopup
Definition: libkviurl.h:80
KviTalMenuBar * m_pMenuBar
Definition: libkviurl.h:79
QCheckBox * m_pEnable
Definition: libkviurl.h:114
ConfigDialog()
Definition: libkviurl.cpp:322
void close_slot()
Definition: libkviurl.cpp:194
QString window
Definition: libkviurl.h:51
void sayToWin(QAction *act)
Definition: libkviurl.cpp:259
void saveList()
Definition: libkviurl.cpp:174
QPixmap * myIconPtr()
Definition: libkviurl.cpp:278
Definition: libkviurl.h:126
QString m_szUrl
Definition: libkviurl.h:81
UrlDialogTreeWidget(QWidget *)
Definition: libkviurl.cpp:83
struct _KviUrl KviUrl
void config()
Definition: libkviurl.cpp:164
QListWidget * m_pBanList
Definition: libkviurl.h:115
~ConfigDialog()
Definition: libkviurl.cpp:388
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
A template double linked list of pointers.
Definition: KviPointerList.h:55
void rightButtonPressed(QTreeWidgetItem *, QPoint)
#define cbnum
Definition: libkviurl.h:124
KviPointerList< KviUrl > * g_pList
Definition: libkviurl.cpp:67
void addBan()
Definition: libkviurl.cpp:443
QCheckBox * cb[cbnum]
Definition: libkviurl.h:134
void loadList()
Definition: libkviurl.cpp:179
QString name()
Definition: KviRuntimeInfo.cpp:655
void mousePressEvent(QMouseEvent *e)
Definition: libkviurl.cpp:88
Contains the KviWindow class.
void discardbtn()
Definition: libkviurl.cpp:363
Definition: libkviurl.h:48
void closeEvent(QCloseEvent *)
Definition: libkviurl.cpp:383
int count
Definition: libkviurl.h:52
void resizeEvent(QResizeEvent *)
Definition: libkviurl.cpp:303
void acceptbtn()
Definition: libkviurl.cpp:368
void popup(QTreeWidgetItem *item, const QPoint &p)
Definition: libkviurl.cpp:231
Definition: libkviurl.h:71
QString timestamp
Definition: libkviurl.h:53
void help()
Definition: libkviurl.cpp:170
COMPILE_KDE4_SUPPORT.
Definition: KviTalMenuBar.h:50
BanFrame(QWidget *parent=0, const char *name=0, bool banEnable=false)
Definition: libkviurl.cpp:399
#define p
Definition: detector.cpp:80
void clear()
Definition: libkviurl.cpp:184
QPushButton * m_pAddBtn
Definition: libkviurl.h:116
Actions handling.
void enableClicked()
Definition: libkviurl.cpp:436
UrlDialog(KviPointerList< KviUrl > *g_pList)
Definition: libkviurl.cpp:139