summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-14 20:40:33 (UTC)
committer zecke <zecke>2004-03-14 20:40:33 (UTC)
commitb7362708c9d5a1765aa22fdcc87a9b3009cda6b9 (patch) (side-by-side diff)
treef6dc914fbc7bf86f4fc311bd80aeb1cfb03218de
parentfb19e9dc49a8ed0f1b85fa88ed97d357000955e1 (diff)
downloadopie-b7362708c9d5a1765aa22fdcc87a9b3009cda6b9.zip
opie-b7362708c9d5a1765aa22fdcc87a9b3009cda6b9.tar.gz
opie-b7362708c9d5a1765aa22fdcc87a9b3009cda6b9.tar.bz2
No using namespace in a public header
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ui/opimrecurrencewidget.cpp8
-rw-r--r--libopie2/opiepim/ui/opimrecurrencewidget.h10
2 files changed, 9 insertions, 9 deletions
diff --git a/libopie2/opiepim/ui/opimrecurrencewidget.cpp b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
index 90c1a5f..ee7f3a3 100644
--- a/libopie2/opiepim/ui/opimrecurrencewidget.cpp
+++ b/libopie2/opiepim/ui/opimrecurrencewidget.cpp
@@ -1,172 +1,174 @@
#include <qapplication.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qspinbox.h>
#include <qpe/timestring.h>
#include "opimrecurrencewidget.h"
+
+using namespace Opie;
// Global Templates for use in setting up the repeat label...
// the problem is these strings get initialized before QPEApplication can install the translator -zecke
namespace {
QString strDayTemplate;
QString strYearTemplate;
QString strMonthDateTemplate;
QString strMonthDayTemplate;
QString strWeekTemplate;
QString dayLabel[7];
}
/*
* static linkage to not polute the symbol table...
* The problem is that const and static linkage are resolved prior to installing a translator
* leading to that the above strings are translted but to the original we delay the init of these strings...
* -zecke
*/
static void fillStrings() {
strDayTemplate = QObject::tr("Every");
strYearTemplate = QObject::tr("%1 %2 every ");
strMonthDateTemplate = QObject::tr("The %1 every ");
strMonthDayTemplate = QObject::tr("The %1 %2 of every");
strWeekTemplate = QObject::tr("Every ");
dayLabel[0] = QObject::tr("Monday");
dayLabel[1] = QObject::tr("Tuesday");
dayLabel[2] = QObject::tr("Wednesday");
dayLabel[3] = QObject::tr("Thursday");
dayLabel[4] = QObject::tr("Friday");
dayLabel[5] = QObject::tr("Saturday");
dayLabel[6] = QObject::tr("Sunday");
}
static QString numberPlacing( int x ); // return the proper word format for
// x (1st, 2nd, etc)
static int week( const QDate &dt ); // what week in the month is dt?
/**
* Constructs the Widget
* @param startOnMonday Does the week start on monday
* @param newStart The start date of the recurrence
* @param parent The parent widget
* @param name the name of object
* @param modal if the dialog should be modal
* @param fl Additional window flags
*/
OPimRecurrenceWidget::OPimRecurrenceWidget( bool startOnMonday,
const QDate& newStart,
QWidget* parent,
const char* name,
bool modal,
WFlags fl )
: OPimRecurrenceBase( parent, name, modal, fl ),
start( newStart ),
currInterval( None ),
startWeekOnMonday( startOnMonday )
{
if (strDayTemplate.isEmpty() )
fillStrings();
init();
fraType->setButton( currInterval );
chkNoEnd->setChecked( TRUE );
setupNone();
}
/**
* Different constructor
* @param startOnMonday Does the week start on monday?
* @param rp Already set OPimRecurrence object
* @param startDate The start date
* @param parent The parent widget
* @param name The name of the object
* @param modal
* @param fl The flags for window
*/
OPimRecurrenceWidget::OPimRecurrenceWidget( bool startOnMonday,
- const OPimRecurrence& rp, const QDate& startDate,
+ const Opie::OPimRecurrence& rp, const QDate& startDate,
QWidget* parent, const char* name,
bool modal, WFlags fl)
: OPimRecurrenceBase( parent, name, modal, fl ),
start( startDate ),
end( rp.endDate() ),
startWeekOnMonday( startOnMonday )
{
if (strDayTemplate.isEmpty() )
fillStrings();
// do some stuff with the repeat pattern
init();
setRecurrence( rp );
}
OPimRecurrenceWidget::~OPimRecurrenceWidget() {
}
/**
* set the start date
* @param date the new start date
*/
void OPimRecurrenceWidget::setStartDate( const QDate& date ) {
setRecurrence( recurrence(), date );
}
/**
* set the recurrence
* @param rp The OPimRecurrence object with the new recurrence rules
*/
-void OPimRecurrenceWidget::setRecurrence( const OPimRecurrence& rp ) {
+void OPimRecurrenceWidget::setRecurrence( const Opie::OPimRecurrence& rp ) {
setRecurrence( rp, start );
}
/**
* overloaded method taking OPimRecurrence and a new start date
* @param rp Recurrence rule
* @param date The new start date
*/
-void OPimRecurrenceWidget::setRecurrence( const OPimRecurrence& rp, const QDate& date ) {
+void OPimRecurrenceWidget::setRecurrence( const Opie::OPimRecurrence& rp, const QDate& date ) {
start = date;
end = rp.endDate();
switch ( rp.type() ) {
default:
case OPimRecurrence::NoRepeat:
currInterval = None;
setupNone();
break;
case OPimRecurrence::Daily:
currInterval = Day;
setupDaily();
break;
case OPimRecurrence::Weekly:
currInterval = Week;
setupWeekly();
int day, buttons;
for ( day = 0x01, buttons = 0; buttons < 7;
day = day << 1, buttons++ ) {
if ( rp.days() & day ) {
if ( startWeekOnMonday )
fraExtra->setButton( buttons );
else {
if ( buttons == 7 )
fraExtra->setButton( 0 );
else
fraExtra->setButton( buttons + 1 );
}
}
}
slotWeekLabel();
break;
case OPimRecurrence::MonthlyDay:
currInterval = Month;
setupMonthly();
fraExtra->setButton( 0 );
slotMonthLabel( 0 );
break;
case OPimRecurrence::MonthlyDate:
currInterval = Month;
setupMonthly();
fraExtra->setButton( 1 );
slotMonthLabel( 1 );
break;
case OPimRecurrence::Yearly:
currInterval = Year;
setupYearly();
break;
}
diff --git a/libopie2/opiepim/ui/opimrecurrencewidget.h b/libopie2/opiepim/ui/opimrecurrencewidget.h
index 3f28565..2c315b3 100644
--- a/libopie2/opiepim/ui/opimrecurrencewidget.h
+++ b/libopie2/opiepim/ui/opimrecurrencewidget.h
@@ -1,93 +1,91 @@
/*
* GPL and based on the widget from TT
*/
#ifndef OPIE_PIM_RECURRENCE_WIDGET_H
#define OPIE_PIM_RECURRENCE_WIDGET_H
#include <opie2/opimrecurrence.h>
#include <qpe/datebookmonth.h>
#include <qlist.h>
#include <qtoolbutton.h>
#include <qcheckbox.h>
#include <qdatetime.h>
#include <qbuttongroup.h>
#include "opimrecurrencebase.h"
-using namespace Opie;
-
/**
* A widget to let the user select rules for recurrences.
* This widget can take care of weekly, monthly, daily and yearly recurrence
* It is used inside todolist and datebook.
*
*
* @short Widget of selecting Recurrance
* @author Trolltech, Holger Freyther
* @version 0.9
*/
class OPimRecurrenceWidget : public OPimRecurrenceBase {
Q_OBJECT
public:
OPimRecurrenceWidget( bool startOnMonday,
const QDate& start, QWidget* parent = 0,
const char* name = 0, bool modal = TRUE,
WFlags fl = 0 );
OPimRecurrenceWidget( bool startOnMonday,
- const OPimRecurrence& rp, const QDate& start,
+ const Opie::OPimRecurrence& rp, const QDate& start,
QWidget* parent = 0, const char* name =0,
bool modal = TRUE, WFlags = 0 );
~OPimRecurrenceWidget();
- OPimRecurrence recurrence()const;
+ Opie::OPimRecurrence recurrence()const;
QDate endDate()const;
public slots:
void slotSetRType( int );
/**
* set the new end date
*/
void endDateChanged( int, int, int );
/**
* enable/disable end date
*/
void slotNoEnd( bool unused );
void setStartDate( const QDate& );
- void setRecurrence( const OPimRecurrence& recur, const QDate& start );
- void setRecurrence( const OPimRecurrence& recur );
+ void setRecurrence( const Opie::OPimRecurrence& recur, const QDate& start );
+ void setRecurrence( const Opie::OPimRecurrence& recur );
private slots:
void setupRepeatLabel( const QString& );
void setupRepeatLabel( int );
void slotWeekLabel();
void slotMonthLabel( int );
void slotChangeStartOfWeek( bool onMonday );
private:
void setupNone();
void setupDaily();
void setupWeekly();
void setupMonthly();
void setupYearly();
enum repeatButtons { None, Day, Week, Month, Year };
void init();
void hideExtras();
void showRepeatStuff();
QList<QToolButton> listRTypeButtons;
QList<QToolButton> listExtra;
QDate start; // only used in one spot...
QDate end;
repeatButtons currInterval;
bool startWeekOnMonday : 1;
DateBookMonth *repeatPicker;
class Private;
Private *d;
};
#endif