~ubuntu-branches/ubuntu/precise/knemo/precise

« back to all changes in this revision

Viewing changes to src/kcm/kdatepickerpopup.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2010-01-06 17:16:51 UTC
  • mfrom: (1.1.9 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100106171651-ff58ryfnav4l1zbm
Tags: 0.6.0-1
* New upstream release 
  - Fixes "FTBFS: sysbackend.cpp:362: error: 'KILO' was not declared in
  this scope" (Closes: #560496)
  - Fixes "context menu does not appear" (Closes: #504791)
* Add Build-Depends: libnl-dev - Linux netlink sockets library

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  This file is part of libkdepim.
 
3
 
 
4
  Copyright (c) 2004 Bram Schoenmakers <bramschoenmakers@kde.nl>
 
5
 
 
6
  This library is free software; you can redistribute it and/or
 
7
  modify it under the terms of the GNU Library General Public
 
8
  License as published by the Free Software Foundation; either
 
9
  version 2 of the License, or (at your option) any later version.
 
10
 
 
11
  This library is distributed in the hope that it will be useful,
 
12
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
  Library General Public License for more details.
 
15
 
 
16
  You should have received a copy of the GNU Library General Public License
 
17
  along with this library; see the file COPYING.LIB.  If not, write to
 
18
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
  Boston, MA 02110-1301, USA.
 
20
*/
 
21
#ifndef KDATEPICKERPOPUP_H
 
22
#define KDATEPICKERPOPUP_H
 
23
 
 
24
#include <QDateTime>
 
25
#include <QMenu>
 
26
 
 
27
class KDatePicker;
 
28
 
 
29
/**
 
30
   @short This menu helps the user to select a date quickly.
 
31
 
 
32
   This menu helps the user to select a date quicly. It offers various
 
33
   ways of selecting, e.g. with a KDatePicker or with words like "Tomorrow".
 
34
 
 
35
   The available items are:
 
36
 
 
37
   @li NoDate: A menu-item with "No Date". If chosen, the datepicker will emit
 
38
       a null QDate.
 
39
   @li DatePicker: Show a KDatePicker-widget.
 
40
   @li Words: Show items like "Today", "Tomorrow" or "Next Week".
 
41
 
 
42
   When supplying multiple items, separate each item with a bitwise OR.
 
43
 
 
44
   @author Bram Schoenmakers <bram_s@softhome.net>
 
45
*/
 
46
class KDatePickerPopup: public QMenu
 
47
{
 
48
  Q_OBJECT
 
49
 
 
50
  public:
 
51
    enum ItemFlag {
 
52
      NoDate = 1,
 
53
      DatePicker = 2,
 
54
      Words = 4
 
55
    };
 
56
 
 
57
    Q_DECLARE_FLAGS( Items, ItemFlag )
 
58
 
 
59
    /**
 
60
       A constructor for the KDatePickerPopup.
 
61
 
 
62
       @param items List of all desirable items, separated with a bitwise OR.
 
63
       @param date Initial date of datepicker-widget.
 
64
       @param parent The object's parent.
 
65
       @param name The object's name.
 
66
    */
 
67
    explicit KDatePickerPopup( Items items = DatePicker,
 
68
                               const QDate &date = QDate::currentDate(),
 
69
                               QWidget *parent = 0 );
 
70
 
 
71
    /**
 
72
       @return A pointer to the private variable mDatePicker, an instance of
 
73
       KDatePicker.
 
74
    */
 
75
    KDatePicker *datePicker() const;
 
76
 
 
77
    void setDate( const QDate &date );
 
78
 
 
79
#if 0
 
80
    /** Set items which should be shown and rebuilds the menu afterwards.
 
81
        Only if the menu is not visible.
 
82
        @param items List of all desirable items, separated with a bitwise OR.
 
83
    */
 
84
    void setItems( int items = 1 );
 
85
#endif
 
86
    /** @return Returns the bitwise result of the active items in the popup. */
 
87
    int items() const { return mItems; }
 
88
 
 
89
  Q_SIGNALS:
 
90
 
 
91
    /**
 
92
      This signal emits the new date (selected with datepicker or other
 
93
      menu-items).
 
94
    */
 
95
    void dateChanged ( const QDate &date );
 
96
 
 
97
  protected Q_SLOTS:
 
98
    void slotDateChanged ( const QDate &date );
 
99
 
 
100
    void slotToday();
 
101
    void slotTomorrow();
 
102
    void slotNextWeek();
 
103
    void slotNextMonth();
 
104
    void slotNoDate();
 
105
 
 
106
  private:
 
107
    void buildMenu();
 
108
 
 
109
    KDatePicker *mDatePicker;
 
110
    Items mItems;
 
111
};
 
112
 
 
113
Q_DECLARE_OPERATORS_FOR_FLAGS( KDatePickerPopup::Items )
 
114
 
 
115
#endif