summaryrefslogtreecommitdiffabout
path: root/korganizer/kofilterview.h
blob: aaf0eb68e489fa8904f4e32ef6eb3d6cc37bdc8d (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
150
151
152
153
154
155
/*
    This file is part of KOrganizer.
    Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>

    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.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

    As a special exception, permission is given to link this program
    with any edition of Qt, and distribute the resulting executable,
    without including the source code for Qt in the source distribution.
*/
#ifndef KOFILTERVIEW_H
#define KOFILTERVIEW_H

#include <qstring.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <kconfig.h>
#include "kofilterview_base.h"

#include <libkcal/calfilter.h>

class QGridLayout;

using namespace KCal;
class KOCalButton : public QPushButton
{
    Q_OBJECT
  public:
    KOCalButton( QWidget *parent=0, const char *name=0 ) :
      QPushButton( parent, name) 
    {
      connect( this, SIGNAL( clicked() ),
               SLOT( bottonClicked() )); 
      mNumber = -1;
    }
    void setNum ( int num ) {mNumber = num; }
    signals:
    void selectNum ( int );
private: 
    int mNumber;
    void keyPressEvent ( QKeyEvent * e )
    {
        e->ignore();     
    }

private slots :
    void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); }
};
class KOCalCheckButton : public QCheckBox
{
    Q_OBJECT
  public:
    KOCalCheckButton( QWidget *parent=0, const char *name=0 ) :
      QCheckBox( parent, name) 
    {
      connect( this, SIGNAL( toggled ( bool ) ),
               SLOT( bottonClicked( bool ) )); 
      mNumber = -1;
      //setMaximumWidth( 10 );

    }
    void setNum ( int num ) {mNumber = num; }
    signals:
    void selectNum ( int, bool );
private: 
    int mNumber;
    void keyPressEvent ( QKeyEvent * e )
    {
        e->ignore();     
    }

private slots :
    void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
};



class KOFilterView : public KOFilterView_base
{
    Q_OBJECT
  public:
    KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
    ~KOFilterView();

    void updateFilters();

    bool filtersEnabled();
    void setFiltersEnabled(bool);
    CalFilter *selectedFilter();
    void setSelectedFilter(QString);
    void setSelectedFilter( int );

  signals:
    void filterChanged();
    void editFilters();

  private:
    QPtrList<CalFilter> *mFilters;
};

class KOCalEditView : public QWidget
{
    Q_OBJECT
  public:
    KOCalEditView( QWidget* parent=0,const char* name=0);
    ~KOCalEditView();

    void readConfig();
    public slots:
    void addCal();
    void enableAll();
    void enableAlarm();
    void disableRO();
    void deleteAll();
    void selectStdCal(int,bool );
    void selectCal(int,bool );
    void selectCalAlarm(int,bool );
    void selectReadOnly(int,bool );
    void setColor(const QColor &,int) ;
    void deleteCal(int) ;
    void infoCal(int) ;
  signals:
    void alarmEnabled ( int cal, bool enable );
    void calendarEnabled ( int cal, bool enable );
    void calendarReadonly ( int cal, bool readonly );
    void setCalendarDefault ( int cal );
    void removeCalendar ( int cal );
    void calendarAdded( int );

  private:
    QVBoxLayout* ml;
    QWidget *mw;
    void toggleList ( QPtrList<KOCalCheckButton> );
    QPtrList<KOCalCheckButton> mStdandardB;
    QPtrList<KOCalCheckButton> mEnabledB;
    QPtrList<KOCalCheckButton> mAlarmB;
    QPtrList<KOCalCheckButton> mROB;
    QGridLayout* mainLayout; 
};



#endif // KOFILTERVIEW_H