[kde-edu]: KDE/kdeedu/libkdeedu

Jason Harris kstars at 30doradus.org
Mon Mar 13 03:53:58 CET 2006


SVN commit 518081 by harris:

Commiting Albert's patch to make ExtDate widgets work in Qt designer.  
Also fixing compile error in ExtDateTime that I introduced last night.

Thanks Albert!

CCMAIL: kde-edu at kde.org



 M  +6 -2      extdate/extdatetime.cpp  
 M  +1 -1      extdate/extdatetime.h  
 M  +38 -27    extdate/extdatetimeedit.cpp  
 M  +4 -0      extdate/extdatetimeedit.h  
 M  +2 -2      widgets/Makefile.am  
 M  +20 -1     widgets/kdeedu.widgets  


--- trunk/KDE/kdeedu/libkdeedu/extdate/extdatetime.cpp #518080:518081
@@ -64,6 +64,9 @@
 	i18n("Friday"), i18n("Saturday"), i18n("Sunday")
 };
 
+ExtDate::ExtDate() : m_jd(INVALID_DAY), m_year(0), m_month(0), m_day(0) 
+{}
+
 ExtDate::ExtDate( int y, int m, int d)
 {
 	if ( !isValid(y,m,d) ) {
@@ -591,8 +594,9 @@
     \sa ExtDate QTime ExtDateTimeEdit
 */
 
-ExtDateTime::ExtDateTime() {
-	ExtDateTime( ExtDate(), QTime() );
+ExtDateTime::ExtDateTime() 
+	: d( ExtDate() ), t( QTime() )
+{
 }
 
 ExtDateTime::ExtDateTime( const ExtDate &date )
--- trunk/KDE/kdeedu/libkdeedu/extdate/extdatetime.h #518080:518081
@@ -64,7 +64,7 @@
    *@short Default constructor
    *Create an invalid date
    */
-  ExtDate() : m_jd(INVALID_DAY), m_year(0), m_month(0), m_day(0) {}
+  ExtDate();
   /**
    *@short Constructor
    *Create an ExtDate for the specified calendar date
--- trunk/KDE/kdeedu/libkdeedu/extdate/extdatetimeedit.cpp #518080:518081
@@ -28,8 +28,28 @@
 
 #include "extdatetimeedit.h"
 
-ExtDateEdit::ExtDateEdit( const ExtDate &d, QWidget *parent ) 
-: QSpinBox( parent ), ActiveField(0), m_Date(d) {
+ExtDateEdit::ExtDateEdit( const ExtDate &d, QWidget *parent )
+: QSpinBox( parent ) {
+	init (d);
+}
+
+ExtDateEdit::ExtDateEdit( int jd, QWidget *parent )
+ : QSpinBox( parent ) {
+	ExtDate ed(jd);
+	init( ed );
+}
+
+ExtDateEdit::ExtDateEdit( QWidget *p )
+ : QSpinBox( p ) {
+	init( ExtDate::currentDate() );
+}
+
+ExtDateEdit::~ExtDateEdit() {
+}
+
+void ExtDateEdit::init( const ExtDate &d ) {
+	ActiveField = 0;
+	m_Date = d;
 	setRange( -20000000, 20000000 ); //range of Julian Days
 
 	//Set the date format to be the Locale's short date format, except:
@@ -50,19 +70,6 @@
 	highlightActiveField();
 }
 
-ExtDateEdit::ExtDateEdit( int jd, QWidget *parent ) {
-	ExtDate ed(jd);
-	ExtDateEdit( ed, parent );
-}
-
-ExtDateEdit::ExtDateEdit( QWidget *p ) {
-	ExtDate ed = ExtDate::currentDate();
-	ExtDateEdit( ed, p );
-}
-
-ExtDateEdit::~ExtDateEdit() {
-}
-
 QString ExtDateEdit::simpleDateFormat() {
 	//Convert the KDE date format string (e.g., "%Y-%m-%d") to one 
 	//that accurately represents the number of digits in each date 
@@ -203,27 +210,31 @@
 
 ExtDateTimeEdit::ExtDateTimeEdit( const ExtDateTime &dt, QWidget *parent )
 : QFrame( parent ) {
-	QHBoxLayout *hlay = new QHBoxLayout( this );
-	m_DateEdit = new ExtDateEdit( dt.date(), this );
-	m_TimeEdit = new QTimeEdit( dt.time(), this );
-
-	hlay->addWidget( m_DateEdit );
-	hlay->addWidget( m_TimeEdit );
+	init( dt );
 }
 
-ExtDateTimeEdit::ExtDateTimeEdit( const ExtDate &date, const QTime &time, QWidget *parent ) {
-	ExtDateTime dt( date, time );
-	ExtDateTimeEdit( dt, parent );
+ExtDateTimeEdit::ExtDateTimeEdit( const ExtDate &date, const QTime &time, QWidget *parent )
+: QFrame( parent ) {
+	init( ExtDateTime( date, time ) );
 }
 
-ExtDateTimeEdit::ExtDateTimeEdit( QWidget *p ) {
-	ExtDateTime edt = ExtDateTime::currentDateTime();
-	ExtDateTimeEdit( edt, p );
+ExtDateTimeEdit::ExtDateTimeEdit( QWidget *p )
+: QFrame( p ) {
+	init( ExtDateTime::currentDateTime() );
 }
 
 ExtDateTimeEdit::~ExtDateTimeEdit() {
 }
 
+void ExtDateTimeEdit::init( const ExtDateTime &dt ) {
+	QHBoxLayout *hlay = new QHBoxLayout( this );
+	m_DateEdit = new ExtDateEdit( dt.date(), this );
+	m_TimeEdit = new QTimeEdit( dt.time(), this );
+
+	hlay->addWidget( m_DateEdit );
+	hlay->addWidget( m_TimeEdit );
+}
+
 edLineEdit::edLineEdit( QWidget *parent ) : QLineEdit( parent ) {
 	edParent = (ExtDateEdit*)parent;
 }
--- trunk/KDE/kdeedu/libkdeedu/extdate/extdatetimeedit.h #518080:518081
@@ -220,6 +220,8 @@
 		QString simpleDateFormat();
 
 	private:
+		void init( const ExtDate &d );
+
 		uchar ActiveField;  // 0==day; 1==month; 2==year
 		ExtDate m_Date;
 		QString m_DateFormat;
@@ -309,6 +311,8 @@
 dt.time() ); }
 
 	private:
+		void init( const ExtDateTime &dt );
+		
 		QTimeEdit *m_TimeEdit;
 		ExtDateEdit *m_DateEdit;
 };
--- trunk/KDE/kdeedu/libkdeedu/widgets/Makefile.am #518080:518081
@@ -1,4 +1,4 @@
-INCLUDES = -I$(srcdir)/../kdeeduplot $(all_includes)
+INCLUDES = -I$(srcdir)/../kdeeduplot $(all_includes) -I$(srcdir)/../extdate
 
 AM_CXXFLAGS = -DQT_PLUGIN
 #KDE_CXXFLAGS = -UQT3_SUPPORT
@@ -7,7 +7,7 @@
 
 kde_widget_LTLIBRARIES = kdeeduwidgets.la
 kdeeduwidgets_la_LDFLAGS = $(KDE_PLUGIN) -module $(all_libraries)
-kdeeduwidgets_la_LIBADD = $(LIB_KIO) ../kdeeduplot/libkdeeduplot.la
+kdeeduwidgets_la_LIBADD = $(LIB_KIO) ../kdeeduplot/libkdeeduplot.la ../extdate/libextdate.la
 kdeeduwidgets_la_SOURCES = kdeeduwidgets.cpp
 
 kdeeduwidgets.cpp: $(srcdir)/kdeedu.widgets
--- trunk/KDE/kdeedu/libkdeedu/widgets/kdeedu.widgets #518080:518081
@@ -5,6 +5,25 @@
 
 [KPlotWidget]
 ToolTip=A plot widget (KDE-Edu)
-WhatsThis=A widget that allows you to plot simple stuff
+WhatsThis=A widget for easily making 2-dimensional plots
 Group=Plot (KDE-Edu)
 ConstructorArgs=(0.0, 1.0, 0.0, 1.0, parent)
+
+[ExtDateEdit]
+ToolTip=spinbox-based extended date editor (KDE-Edu)
+WhatsThis=Allows the user to specify an extended date
+Group=Date and Time (KDE-Edu)
+ConstructorArgs=(parent)
+IncludeFile=extdatetimeedit.h
+
+[ExtDateTimeEdit]
+ToolTip=spinbox-based extended date/time editor (KDE-Edu)
+WhatsThis=Allows the user to specify an extended date and a time
+Group=Date and Time (KDE-Edu)
+ConstructorArgs=(parent)
+
+[ExtDatePicker]
+ToolTip=calendar-based extended date selector (KDE-Edu)
+WhatsThis=Allows the user to specify an extended date using a calendar
+Group=Date and Time (KDE-Edu)
+ConstructorArgs=(parent)


More information about the kde-edu mailing list