Esempio n. 1
0
KDateEdit::KDateEdit(QWidget *parent, const char *name)
  : QFrame(parent, name)
{
  QPixmap pixmap;

  kfEdit = new DateEdit(this);
  kfEdit->setDate(QDate::currentDate(), kfEdit->currentFormat());
  updateConfig(); // adjusts the format of the display

  kfEdit->setFixedHeight(kfEdit->sizeHint().height());
  kfEdit->setFixedWidth(90);
  kfEdit->adjustSize();

  pixmap = Icon("smallcal.xpm");
  dateButton = new QPushButton(this);
  dateButton->setPixmap(pixmap);
  dateButton->move(kfEdit->geometry().topRight().x()+1,
		   kfEdit->geometry().topRight().y());
  dateButton->setFixedHeight(20);
  dateButton->setFixedWidth(30);
  dateButton->adjustSize();

  datePicker = new KODatePicker(parent, QDate::currentDate());
  datePicker->setFixedSize(200,200);

  adjustSize();
  
  connect(dateButton, SIGNAL(clicked()), 
	  this, SLOT(toggleDatePicker()));
  connect(datePicker, SIGNAL(dateSelected(QDate)),
	  this, SLOT(setDate(QDate)));
  connect(datePicker, SIGNAL(dateSelected(QDate)),
	  datePicker, SLOT(hide()));

}
AnnotationDialog::KDateEdit::KDateEdit( bool isStartEdit, QWidget *parent )
    : KComboBox( parent ),
      defaultValue( QDate::currentDate() ),
      mReadOnly(false),
      mDiscardNextMousePress(false),
      mIsStartEdit( isStartEdit )
{
    setEditable(true);
    setMaxCount(1);       // need at least one entry for popup to work
    value = defaultValue;
    QString today = QDate::currentDate().toString( QString::fromLatin1("dd. MMM yyyy") );
    addItem(QString::fromLatin1( "" ) );
    setCurrentIndex(0);
    setItemText( 0, QString::fromLatin1( "" ));
    setMinimumSize(sizeHint());

    mDateFrame = new QFrame;
    mDateFrame->setWindowFlags(Qt::Popup);
    QVBoxLayout* layout = new QVBoxLayout(mDateFrame);
    mDateFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
    mDateFrame->setLineWidth(3);
    mDateFrame->hide();
    mDateFrame->installEventFilter(this);

    mDatePicker = new KDatePicker(value, mDateFrame);
    layout->addWidget(mDatePicker);

    connect(lineEdit(),SIGNAL(editingFinished()),SLOT(lineEnterPressed()));
    connect(this,SIGNAL(textChanged(QString)),
            SLOT(slotTextChanged(QString)));

    connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(dateEntered(QDate)));
    connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(dateSelected(QDate)));

    // Create the keyword list. This will be used to match against when the user
    // enters information.
    mKeywordMap[i18n("tomorrow")] = 1;
    mKeywordMap[i18n("today")] = 0;
    mKeywordMap[i18n("yesterday")] = -1;

    QString dayName;
    for (int i = 1; i <= 7; ++i)
    {
        dayName = KGlobal::locale()->calendar()->weekDayName(i).toLower();
        mKeywordMap[dayName] = i + 100;
    }
    lineEdit()->installEventFilter(this);   // handle keyword entry

    mTextChanged = false;
    mHandleInvalid = false;
}
Esempio n. 3
0
void
ExtDatePicker::tableClickedSlot()
{
  kdDebug(298) << "ExtDatePicker::tableClickedSlot: table clicked." << endl;
  emit(dateSelected(table->getDate()));
  emit(tableClicked());
}
Esempio n. 4
0
CMainDlg::CMainDlg(QWidget *parent, const char *name)
       :QDialog(parent,name)
{
   initMetaObject();
   
   setCaption("KDatePicker Demonstration");
   setFixedSize(2*285,2*152);

   // buttons
   QPushButton *pb;

   pb = new QPushButton("Quit",this);
   pb->setGeometry(2*195,2*130,2*50,2*14);
   connect(pb, SIGNAL(clicked()), SLOT(quitapp()));

   pb = new QPushButton("About",this);
   pb->setGeometry(2*30,2*130,2*50,2*14);
   connect(pb,SIGNAL(clicked()),SLOT(about()));

   KDatePicker *dp;
   dp = new KDatePicker(this);
   dp->setGeometry(10,10,222,200);
   
   m_lab = new QLabel(this);
   m_lab->setGeometry(270, 110, 150, 28);
   
   connect(dp, SIGNAL(dateSelected(QDate)), SLOT(printDate(QDate)));
   
}
Esempio n. 5
0
void
kMyMoneyCalendar::tableClickedSlot()
{
  kDebug() << "kMyMoneyCalendar::tableClickedSlot: table clicked.";
  emit(dateSelected(table->getDate()));
  emit(tableClicked());
}
Esempio n. 6
0
void
KDatePicker::tableClickedSlot()
{
  kDebug()<<k_funcinfo << "KDatePicker::tableClickedSlot: table clicked." << endl;
  emit(dateSelected(d->table->date()));
  emit(tableClicked());
}
Esempio n. 7
0
/**
 * @brief MainTab::MainTab
 *        Default constructor
 */
MainTab::MainTab(QWidget *parent) :
    QWidget(parent), ui(new Ui::MainTab), mExpCond(), mVpm(0)
{

    ui->setupUi(this);
    QObject::connect(ui->calendar, SIGNAL(clicked(QDate)),
                     this,         SLOT(dateSelected(QDate)) );
}
void KConfigDialogManager::initMaps()
{
    if (s_propertyMap()->isEmpty()) {
        s_propertyMap()->insert(QStringLiteral("KButtonGroup"), "current");
        s_propertyMap()->insert(QStringLiteral("KColorButton"), "color");
        s_propertyMap()->insert(QStringLiteral("KColorCombo"), "color");
        //s_propertyMap()->insert( "KUrlRequester", "url" );
        //s_propertyMap()->insert( "KUrlComboRequester", "url" );
    }

    if (s_changedMap()->isEmpty()) {
        // QT
        s_changedMap()->insert(QStringLiteral("QCheckBox"), SIGNAL(stateChanged(int)));
        s_changedMap()->insert(QStringLiteral("QPushButton"), SIGNAL(clicked(bool)));
        s_changedMap()->insert(QStringLiteral("QRadioButton"), SIGNAL(toggled(bool)));
        // We can only store one thing, so you can't have
        // a ButtonGroup that is checkable.
//    s_changedMap()->insert("QButtonGroup", SIGNAL(buttonClicked(int)));
        s_changedMap()->insert(QStringLiteral("QGroupBox"), SIGNAL(toggled(bool)));
        s_changedMap()->insert(QStringLiteral("QComboBox"), SIGNAL(activated(int)));
        //qsqlproperty map doesn't store the text, but the value!
        //s_changedMap()->insert("QComboBox", SIGNAL(textChanged(QString)));
        s_changedMap()->insert(QStringLiteral("QDateEdit"), SIGNAL(dateChanged(QDate)));
        s_changedMap()->insert(QStringLiteral("QTimeEdit"), SIGNAL(timeChanged(QTime)));
        s_changedMap()->insert(QStringLiteral("QDateTimeEdit"), SIGNAL(dateTimeChanged(QDateTime)));
        s_changedMap()->insert(QStringLiteral("QDial"), SIGNAL(valueChanged(int)));
        s_changedMap()->insert(QStringLiteral("QDoubleSpinBox"), SIGNAL(valueChanged(double)));
        s_changedMap()->insert(QStringLiteral("QLineEdit"), SIGNAL(textChanged(QString)));
        s_changedMap()->insert(QStringLiteral("QSlider"), SIGNAL(valueChanged(int)));
        s_changedMap()->insert(QStringLiteral("QSpinBox"), SIGNAL(valueChanged(int)));
        s_changedMap()->insert(QStringLiteral("QTextEdit"), SIGNAL(textChanged()));
        s_changedMap()->insert(QStringLiteral("QTextBrowser"), SIGNAL(sourceChanged(QString)));
        s_changedMap()->insert(QStringLiteral("QPlainTextEdit"), SIGNAL(textChanged()));
        s_changedMap()->insert(QStringLiteral("QTabWidget"), SIGNAL(currentChanged(int)));

        // KDE
        s_changedMap()->insert(QStringLiteral("KComboBox"), SIGNAL(activated(int)));
        s_changedMap()->insert(QStringLiteral("KFontComboBox"), SIGNAL(activated(int)));
        s_changedMap()->insert(QStringLiteral("KFontRequester"), SIGNAL(fontSelected(QFont)));
        s_changedMap()->insert(QStringLiteral("KFontChooser"),  SIGNAL(fontSelected(QFont)));
        s_changedMap()->insert(QStringLiteral("KHistoryCombo"), SIGNAL(activated(int)));
        s_changedMap()->insert(QStringLiteral("KColorCombo"), SIGNAL(activated(QColor)));

        s_changedMap()->insert(QStringLiteral("KColorButton"), SIGNAL(changed(QColor)));
        s_changedMap()->insert(QStringLiteral("KDatePicker"), SIGNAL(dateSelected(QDate)));
        s_changedMap()->insert(QStringLiteral("KDateWidget"), SIGNAL(changed(QDate)));
        s_changedMap()->insert(QStringLiteral("KDateTimeWidget"), SIGNAL(valueChanged(QDateTime)));
        s_changedMap()->insert(QStringLiteral("KEditListWidget"), SIGNAL(changed()));
        s_changedMap()->insert(QStringLiteral("KListWidget"), SIGNAL(itemSelectionChanged()));
        s_changedMap()->insert(QStringLiteral("KLineEdit"), SIGNAL(textChanged(QString)));
        s_changedMap()->insert(QStringLiteral("KPasswordEdit"), SIGNAL(textChanged(QString)));
        s_changedMap()->insert(QStringLiteral("KRestrictedLine"), SIGNAL(textChanged(QString)));
        s_changedMap()->insert(QStringLiteral("KTextEdit"), SIGNAL(textChanged()));
        s_changedMap()->insert(QStringLiteral("KUrlRequester"),  SIGNAL(textChanged(QString)));
        s_changedMap()->insert(QStringLiteral("KUrlComboRequester"),  SIGNAL(textChanged(QString)));
        s_changedMap()->insert(QStringLiteral("KUrlComboBox"),  SIGNAL(urlActivated(QUrl)));
        s_changedMap()->insert(QStringLiteral("KButtonGroup"), SIGNAL(changed(int)));
    }
Esempio n. 9
0
DCalendarPopup::DCalendarPopup(const QDate &date, QWidget *parent)
  : QWidget(parent, Qt::Popup)
{
  _cal = new QCalendarWidget(this);
  _cal->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
  _cal->setSelectedDate(date);

  QVBoxLayout *vbox = new QVBoxLayout(this);
  vbox->setMargin(0);
  vbox->setSpacing(0);
  vbox->addWidget(_cal);

  connect(_cal, SIGNAL(activated(QDate)), this, SLOT(dateSelected(QDate)));
  connect(_cal, SIGNAL(clicked(QDate)),   this, SLOT(dateSelected(QDate)));
  connect(_cal, SIGNAL(activated(QDate)), this, SLOT(dateSelected(QDate)));

  // position the center of the popup near the center of its parent
  if (parent)
  {
    QSize parentsize = parent->sizeHint();
    QPoint parentcenter = parent->pos() + QPoint(parentsize.width() / 2,
						 parentsize.height() / 2);
    parentcenter = parent->mapToGlobal(parentcenter);
    QRect screen = QApplication::desktop()->availableGeometry(parentcenter);

    QSize mysize = sizeHint();
    QPoint mycenter = parentcenter;

    if (mycenter.x() + (mysize.width() / 2) > screen.right())
      mycenter.setX(screen.right() - (mysize.width() / 2));
    else if (mycenter.x() - (mysize.width() / 2) < screen.left())
      mycenter.setX(screen.left() + (mysize.width() / 2));

    if (mycenter.y() + (mysize.height() / 2) > screen.bottom())
      mycenter.setY(screen.bottom() - (mysize.height() / 2));
    else if (mycenter.y() - (mysize.height() / 2) < screen.top())
      mycenter.setY(screen.top() + (mysize.height() / 2));

    QPoint myorigin(mycenter.x() - mysize.width() / 2, mycenter.y() - mysize.height() / 2);

    move(myorigin);
  }

  _cal->setFocus();
}
Esempio n. 10
0
DCalendarPopup::DCalendarPopup(const QDate &date, QWidget *parent)
  : QWidget(parent, Qt::Popup)
{
  _cal = new QCalendarWidget(this);
  _cal->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
  _cal->setSelectedDate(date);

  QVBoxLayout *vbox = new QVBoxLayout(this);
  vbox->setMargin(0);
  vbox->setSpacing(0);
  vbox->addWidget(_cal);

  connect(_cal, SIGNAL(activated(QDate)), this, SLOT(dateSelected(QDate)));
  connect(_cal, SIGNAL(clicked(QDate)),   this, SLOT(dateSelected(QDate)));
  connect(_cal, SIGNAL(activated(QDate)), this, SLOT(dateSelected(QDate)));

  _cal->setFocus();
}
ArchiveDlg::ArchiveDlg(const XMPP::Jid &jid, PsiAccount *pa)
{
	max = 30;
	page_ = 0;
	setupUi(this);
	tw_log->setColumnCount(3);
	QStringList headers;
	headers << tr("Time") << tr("") << tr("Message");
	tw_log->setHeaderLabels(headers);
	setAttribute(Qt::WA_DeleteOnClose);
	setWindowTitle(tr("Archive for ") + jid.full());
#ifndef Q_WS_MAC
	setWindowIcon(IconsetFactory::icon("psi/history").icon());
#endif

	gct_ = NULL;

	pa_ = pa;
	jid_ = jid;

	last_ =  QDateTime::currentDateTime();

	connect(pb_close, SIGNAL(clicked()), this, SLOT(hide()));

	connect(calendar, SIGNAL(selectionChanged()), this, SLOT(dateSelected()));
	connect(calendar, SIGNAL(currentPageChanged(int, int)), this, SLOT(dateChanged(int, int)));

	connect(lw_conversations, SIGNAL(itemSelectionChanged()), this, SLOT(collectionSelected()));
	connect(lw_conversations, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(doCollectionContextMenu(const QPoint&)));
	lw_conversations->

	connect(tb_prevPage, SIGNAL(clicked()), this, SLOT(prevPage()));	connect(tb_nextPage, SIGNAL(clicked()), this, SLOT(nextPage()));

	gclt_ = new GetCollectionListTask(pa->client()->rootTask());
	connect(gclt_, SIGNAL(busy()), this, SLOT(busy()));
	connect(gclt_, SIGNAL(done()), this, SLOT(collectionListRetrieved()));
	connect(gclt_, SIGNAL(error()), this, SLOT(error()));

	gct_ = new GetCollectionTask(pa_->client()->rootTask());
	connect(gct_, SIGNAL(busy()), this, SLOT(busy()));
	connect(gct_, SIGNAL(done(int)), this, SLOT(collectionRetrieved(int)));
	connect(gct_, SIGNAL(msg(int, bool, const QString&)), this, SLOT(collectionMsg(int, bool, const QString&)));
	connect(gct_, SIGNAL(error()), this, SLOT(error()));
	
	QDate m(last_.date().year(), last_.date().month(), 1);
	gclt_->get(jid, m, 50);
//	X11WM_CLASS("history");
}
Esempio n. 12
0
KDatePickerPopup::KDatePickerPopup( int items, const QDate &date, QWidget *parent,
                                    const char *name )
  : QPopupMenu( parent, name )
{
  mItems = items;

  mDatePicker = new KDatePicker( this );
  mDatePicker->setCloseButton( false );

  connect( mDatePicker, SIGNAL( dateEntered( QDate ) ),
           SLOT( slotDateChanged( QDate ) ) );
  connect( mDatePicker, SIGNAL( dateSelected( QDate ) ),
           SLOT( slotDateChanged( QDate ) ) );

  mDatePicker->setDate( date );

  buildMenu();
}
Esempio n. 13
0
void SvcRec::mousePressEvent(QMouseEvent *e)
{
  if((e->pos().x()<SVC_REC_X_ORIGIN)||
     (e->pos().x()>(SVC_REC_X_ORIGIN+SVC_REC_X_INTERVAL*7))||
     (e->pos().y()<SVC_REC_Y_ORIGIN)||
     (e->pos().y()>(SVC_REC_Y_ORIGIN+SVC_REC_Y_INTERVAL*7))) {
    QWidget::mousePressEvent(e);
    return;
  }
  int dow=(e->pos().x()-SVC_REC_X_ORIGIN)/SVC_REC_X_INTERVAL;
  int week=(e->pos().y()-SVC_REC_Y_ORIGIN)/SVC_REC_Y_INTERVAL-1;
  if((dow<0)||(dow>6)||(week<0)||(week>6)) {
    return;
  }
  if(pick_date_label[week][dow]->text().isEmpty()) {
    return;
  }
  pick_date=QDate(pick_date.year(),pick_date.month(),
		  pick_date_label[week][dow]->text().toInt());
  PrintDays();
  emit dateSelected(pick_date,pick_active_days[pick_date.day()-1]);
}
Esempio n. 14
0
void HistoryDialog::slotFilterChanged(int /* index */)
{
	dateSelected(mMainWidget->dateListView->currentItem());
}
AgendaView::AgendaView(QWidget *parent)
    :SIView(parent)
{
    const QDateTime &dateTime = QDateTime::currentDateTime();
    setCurrentMonth((Month)(dateTime.date().month() - 1));

    setObjectName(QString().sprintf("AgendaView%p", parent));

    QWidget *centralWidget = new QWidget(this);
    centralWidget->setObjectName(QString().sprintf("%p", centralWidget));

    resize(QApplication::desktop()->width(), 436);
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    setMinimumWidth(QApplication::desktop()->width());
    setMinimumHeight(436);

    centralWidget->setStyleSheet(QString("QWidget#%1 { background-image: url(:/images/res/fondo_base.png); }").arg(centralWidget->objectName()));
    //centralWidget->setStyleSheet(QString("QWidget#%1 { background-image: url(:/images/res/screens/agenda.png); }").arg(centralWidget->objectName()));
    centralWidget->resize(size());
    centralWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    centralWidget->setMinimumWidth(QApplication::desktop()->width());
    centralWidget->setMinimumHeight(436);

    m_monthLabel = new QLabel(centralWidget);
    m_monthLabel->setObjectName(QString().sprintf("monthLabel%p", m_monthLabel));
    m_monthLabel->setGeometry(QRect(0, 19, 360, 20));
    m_monthLabel->setStyleSheet(QString::fromUtf8("QLabel#%1 { font: 75 20px \"AvantGardeMdITCTT\"; color: rgb(222,222,222) }").arg(m_monthLabel->objectName()));
    m_monthLabel->setWordWrap(false);
    m_monthLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
    m_monthLabel->setText(months[currentMonth()].toUpper());

    QPushButton *buttonLeft = new QPushButton(centralWidget);
    buttonLeft->setObjectName("buttonLeft");
    buttonLeft->setGeometry(0, 0, 54, 54);
    buttonLeft->setText("");
    buttonLeft->setFlat(true);
    buttonLeft->setStyleSheet(QString("QPushButton#buttonLeft { background-color: rgba(255,0,0,0); color: rgb(222, 222, 222); font: 75 20px \"AvantGardeMdITCTT\"; }"));
    connect(buttonLeft, SIGNAL(clicked()), this, SLOT(backMonthPressed()));

    QPushButton *buttonRight = new QPushButton(centralWidget);
    buttonRight->setObjectName("buttonRight");
    buttonRight->setGeometry(306, 0, 54, 54);
    buttonRight->setText("");
    buttonRight->setFlat(true);
    buttonRight->setStyleSheet(QString("QPushButton#buttonRight { background-color: rgba(255,0,0,0); color: rgb(222, 222, 222); font: 75 20px \"AvantGardeMdITCTT\"; }"));
    connect(buttonRight, SIGNAL(clicked()), this, SLOT(forwardMonthPressed()));

    m_calendarWidget = new CustomCalendarWidget(centralWidget);
    m_calendarWidget->setObjectName(QString::fromUtf8("calendarWidget"));
    m_calendarWidget->setGeometry(QRect(5, 20, 350, 325));
    m_calendarWidget->setGridVisible(false);
    m_calendarWidget->setSelectionMode(QCalendarWidget::SingleSelection);
    m_calendarWidget->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
    m_calendarWidget->setHorizontalHeaderFormat(QCalendarWidget::ShortDayNames);
    m_calendarWidget->setNavigationBarVisible(true);
    m_calendarWidget->setDateEditEnabled(false);
    m_calendarWidget->setLocale(QLocale(QLocale::Spanish, QLocale::Argentina));
    m_calendarWidget->setAutoFillBackground(false);
    m_calendarWidget->setStyleSheet(QString("CustomCalendarWidget#calendarWidget { background-color: rgba(0,255,0,0); alternate-background-color: rgba(255, 255, 0, 0); selection-color: rgb(255, 255, 0); font: 75 20px \"AvantGardeMdITCTT\"; }"));
    QTextCharFormat format;
    format.setForeground(QColor(190,190,190));
    format.setBackground(QColor(255,0,0,0));
    format.setFontCapitalization(QFont::AllLowercase);
    m_calendarWidget->setHeaderTextFormat(format);
    format.setForeground(QColor(150,150,150));
    format.setBackground(QColor(255,0,0,0));
    format.setFontPointSize(6);
    m_calendarWidget->setWeekdayTextFormat(Qt::Monday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Tuesday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Wednesday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Thursday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Friday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Saturday, format);
    m_calendarWidget->setWeekdayTextFormat(Qt::Sunday, format);
    m_calendarWidget->setDateList(&GlobalDataObject::instance().datesExercisedList());
    connect(m_calendarWidget, SIGNAL(clicked(QDate)), this, SLOT(dateSelected(QDate)));

    QWidget *labelTip = new QWidget(centralWidget);
    labelTip->setObjectName(QString().sprintf("labelTip%p", labelTip));
    labelTip->setGeometry(0, 375, 264, 26);
    labelTip->setStyleSheet(QString("QWidget#%1 { image: url(:/images/res/agenda_tip.png); }").arg(labelTip->objectName()));
    labelTip->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

}
Esempio n. 16
0
Tools::Tools(bool thisIsABackup, QWidget *parent) : QToolBar(parent) {

	// This variable holds whether the toolbar is used for a backup or not (add and edit buttons disabled for backups)
	this->thisIsABackup = thisIsABackup;

	this->setFloatable(false);
	this->setMovable(false);
	this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	this->setIconSize(QSize(20,20));

	addBooking = new QToolButton;
	addBooking->setIcon(QIcon(":/images/add.png"));
	addBooking->setText("Add &New");
	addBooking->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	addBooking->setStyleSheet("font-size: 11pt; font-weight: bold");
	addBooking->setFixedHeight(40);
	addBooking->setStatusTip("Add a new booking");
	if(thisIsABackup) addBooking->setEnabled(false);

	editBooking = new QToolButton;
	editBooking->setIcon(QIcon(":/images/edit.png"));
	editBooking->setText("&Edit");
	editBooking->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	editBooking->setStyleSheet("font-size: 11pt; font-weight: bold");
	editBooking->setFixedHeight(40);
	editBooking->setStatusTip("Edit Booking");
	if(thisIsABackup) editBooking->setEnabled(false);

	gotoToday_but = new QToolButton;
	gotoToday_but->setIcon(QIcon(":/images/calendar.png"));
	gotoToday_but->setText("Go to &Today");
	gotoToday_but->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	gotoToday_but->setStyleSheet("font-size: 11pt; font-weight: bold");
	gotoToday_but->setFixedHeight(40);
	gotoToday_but->setStatusTip("Go to Today");

	currentDate = QDate::currentDate();
	gotoPrev = new QToolButton;
	gotoPrev->setIcon(QIcon(":/images/left.png"));
	gotoPrev->setStatusTip("Go to previous day");
	gotoPrev->setFixedSize(50,40);
	gotoPrev->setShortcut(QKeySequence("Alt+Left"));
	gotoNext = new QToolButton;
	gotoNext->setIcon(QIcon(":/images/right.png"));
	gotoNext->setStatusTip("Go to next day");
	gotoNext->setFixedSize(50,40);
	gotoNext->setShortcut(QKeySequence("Alt+Right"));
	curDate = new QToolButton;
	curDate->setStatusTip("Select date from calendar");
	curDate->setText(QDate::currentDate().toString("dddd, dd MMM yyyy"));
	curDate->setStyleSheet("font-size: 11pt; font-weight: bold");
	curDate->setFixedSize(220,40);
	curDate->setPopupMode(QToolButton::InstantPopup);
	curDate->setShortcut(QKeySequence("Alt+C"));

	cal = new QCalendarWidget;
	cal->setMinimumDate(QDate(QDate::currentDate().year()-100,1,1));
	cal->setMaximumDate(QDate(QDate::currentDate().year()+100,12,31));
	cal->setFixedWidth(400);
	cal->setFixedHeight(300);
	cal->setGridVisible(true);
	cal->setStyleSheet("font-size: 12pt; font-weight: bold");
	QTextCharFormat format;
	format.setFontWeight(QFont::Bold);
	format.setBackground(QBrush(QColor(220,220,220)));
	cal->setHeaderTextFormat(format);
	m = new QMenu;
	QWidgetAction *a = new QWidgetAction(m);
	a->setDefaultWidget(cal);
	m->addAction(a);
	curDate->setMenu(m);
	m->installEventFilter(this);

	connect(m, SIGNAL(aboutToShow()), this, SLOT(clickForCalendar()));

	showCancelled = new QCheckBox("Also show cancelled bookings");

	filterAdv = new QToolButton;
	filterAdv->setCheckable(true);
	filterAdv->setText("&Search");
	filterAdv->setIcon(QIcon(":/images/search.png"));
	filterAdv->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	filterAdv->setStyleSheet("font-size: 11pt; font-weight: bold");
	filterAdv->setFixedHeight(40);
	filter = new CustomLineEdit;
	filter->setStyleSheet("font-size: 11pt");

	this->addWidget(addBooking);
	this->addSeparator();
	this->addWidget(editBooking);
	this->addSeparator();
	this->addWidget(gotoToday_but);
	this->addWidget(gotoPrev);
	this->addWidget(curDate);
	this->addWidget(gotoNext);

	QWidget *separator1 = new QWidget;
	separator1->setSizePolicy(QSizePolicy::Expanding,
				 QSizePolicy::Expanding);
	QWidget *separator2 = new QWidget;
	separator2->setFixedWidth(10);
	QWidget *separator3 = new QWidget;
	separator3->setFixedWidth(10);

	this->addWidget(separator1);
	this->addWidget(filterAdv);
	this->addWidget(filter);
	this->addWidget(separator2);
	this->addSeparator();
	this->addWidget(separator3);


	connect(gotoToday_but, SIGNAL(clicked()), this, SLOT(gotoToday()));
	connect(gotoNext, SIGNAL(clicked()), this, SLOT(nextDay()));
	connect(gotoPrev, SIGNAL(clicked()), this, SLOT(prevDay()));
	connect(cal, SIGNAL(clicked(QDate)), this, SLOT(dateSelected()));

	connect(filter, SIGNAL(textChanged(QString)), this, SIGNAL(setFilter(QString)));

}