summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime
Side-by-side diff
Diffstat (limited to 'noncore/settings/netsystemtime') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/main.cpp10
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp11
-rw-r--r--noncore/settings/netsystemtime/mainwindow.h3
-rw-r--r--noncore/settings/netsystemtime/netsystemtime.pro7
4 files changed, 12 insertions, 19 deletions
diff --git a/noncore/settings/netsystemtime/main.cpp b/noncore/settings/netsystemtime/main.cpp
index 4b20a61..da98eee 100644
--- a/noncore/settings/netsystemtime/main.cpp
+++ b/noncore/settings/netsystemtime/main.cpp
@@ -20,22 +20,16 @@
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "mainwindow.h"
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-int main( int argc, char ** argv )
-{
- QPEApplication a( argc, argv );
- MainWindow mw;
- a.showMainWidget( &mw );
-
- return a.exec();
-}
+OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index 2d240ba..66e1ca3 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -30,36 +30,37 @@
#include "timetabwidget.h"
#include "formattabwidget.h"
#include "settingstabwidget.h"
#include "ntptabwidget.h"
#include "predicttabwidget.h"
#include <opie/oprocess.h>
#include <opie/otabwidget.h>
#include <qpe/config.h>
#include <qpe/datebookdb.h>
#include <qpe/qpeapplication.h>
+#include <qpe/qpedialog.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qlayout.h>
#include <qmessagebox.h>
#include <qsocket.h>
#include <qstring.h>
#include <qtimer.h>
-MainWindow::MainWindow()
+MainWindow::MainWindow( QWidget *parent , const char *name, bool modal, WFlags f )
: QDialog( 0x0, 0x0, TRUE, 0 )
{
setCaption( tr( "SystemTime" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Create main tabbed control
mainWidget = new OTabWidget( this );
// Default object pointers to null
@@ -70,29 +71,28 @@ MainWindow::MainWindow()
mainWidget->addTab( timeTab = new TimeTabWidget( mainWidget ), "netsystemtime/DateTime", tr( "Time" ) );
mainWidget->addTab( formatTab = new FormatTabWidget( mainWidget ), "netsystemtime/formattab", tr( "Format" ) );
mainWidget->addTab( settingsTab = new SettingsTabWidget( mainWidget ), "SettingsIcon", tr( "Settings" ) );
mainWidget->addTab( predictTab = new PredictTabWidget( mainWidget ), "netsystemtime/predicttab", tr( "Predict" ) );
Config config( "ntp" );
config.setGroup( "settings" );
slotDisplayNTPTab( config.readBoolEntry( "displayNtpTab", FALSE ) );
slotDisplayPredictTab( config.readBoolEntry( "displayPredictTab", FALSE ) );
mainWidget->setCurrentTab( tr( "Time" ) );
layout->addWidget( mainWidget );
- // Create QCOP channel
- QCopChannel *channel = new QCopChannel( "QPE/Application/netsystemtime", this );
- connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
+ connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
this, SLOT(slotQCopReceive(const QCString&, const QByteArray&)) );
+
// Create NTP socket
ntpSock = new QSocket( this );
connect( ntpSock, SIGNAL(error(int)),SLOT(slotCheckNtp(int)) );
slotProbeNTPServer();
// Create timer for automatic time lookups
ntpTimer = new QTimer( this );
// Connect everything together
connect( timeTab, SIGNAL(getNTPTime()), this, SLOT(slotGetNTPTime()) );
connect( timeTab, SIGNAL(tzChanged(const QString &)), predictTab, SLOT(slotTZChanged(const QString &)) );
connect( timeTab, SIGNAL(getPredictedTime()), predictTab, SLOT(slotSetPredictedTime()) );
@@ -101,25 +101,26 @@ MainWindow::MainWindow()
timeTab, SLOT(slotDateFormatChanged(const DateFormat &)) );
connect( formatTab, SIGNAL(weekStartChanged(int)), timeTab, SLOT(slotWeekStartChanged(int)) );
connect( settingsTab, SIGNAL(ntpDelayChanged(int)), this, SLOT(slotNTPDelayChanged(int)) );
connect( settingsTab, SIGNAL(displayNTPTab(bool)), this, SLOT(slotDisplayNTPTab(bool)) );
connect( settingsTab, SIGNAL(displayPredictTab(bool)), this, SLOT(slotDisplayPredictTab(bool)) );
connect( predictTab, SIGNAL(setTime(const QDateTime &)), this, SLOT(slotSetTime(const QDateTime &)) );
// Do initial time server check
slotNTPDelayChanged( config.readNumEntry( "ntpRefreshFreq", 1440 ) );
slotCheckNtp( -1 );
// Display app
- showMaximized();
+ //showMaximized();
+ (void)new QPEDialogListener(this);
}
MainWindow::~MainWindow()
{
if ( ntpProcess )
delete ntpProcess;
}
void MainWindow::accept()
{
// Turn off the screensaver (Note: needs to be encased in { } so that it deconstructs and sends)
{
diff --git a/noncore/settings/netsystemtime/mainwindow.h b/noncore/settings/netsystemtime/mainwindow.h
index fa94335..1cdbc1a 100644
--- a/noncore/settings/netsystemtime/mainwindow.h
+++ b/noncore/settings/netsystemtime/mainwindow.h
@@ -39,26 +39,27 @@ class PredictTabWidget;
class OProcess;
class OTabWidget;
class QDateTime;
class QSocket;
class QTimer;
class MainWindow : public QDialog
{
Q_OBJECT
public:
- MainWindow();
+ MainWindow( QWidget *parent = 0, const char *name = 0, bool modal = FALSE,WFlags f = 0);
~MainWindow();
+ static QString appName() { return QString::fromLatin1("systemtime"); }
protected:
void accept();
void reject();
private:
OTabWidget *mainWidget;
TimeTabWidget *timeTab;
FormatTabWidget *formatTab;
SettingsTabWidget *settingsTab;
NTPTabWidget *ntpTab;
diff --git a/noncore/settings/netsystemtime/netsystemtime.pro b/noncore/settings/netsystemtime/netsystemtime.pro
index 7a12dd1..2140f2e 100644
--- a/noncore/settings/netsystemtime/netsystemtime.pro
+++ b/noncore/settings/netsystemtime/netsystemtime.pro
@@ -1,33 +1,30 @@
-TEMPLATE = app
-CONFIG = qt warn_on debug
-#CONFIG = qt warn_on release
+CONFIG = qt warn_on release quick-app
HEADERS = mainwindow.h \
timetabwidget.h \
formattabwidget.h \
settingstabwidget.h \
predicttabwidget.h \
ntptabwidget.h
SOURCES = main.cpp \
mainwindow.cpp \
timetabwidget.cpp \
formattabwidget.cpp \
settingstabwidget.cpp \
predicttabwidget.cpp \
ntptabwidget.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
-INTERFACES =
-DESTDIR = $(OPIEDIR)/bin
+
TARGET = systemtime
TRANSLATIONS = ../../../i18n/de/systemtime.ts \
../../../i18n/nl/systemtime.ts \
../../../i18n/da/systemtime.ts \
../../../i18n/xx/systemtime.ts \
../../../i18n/en/systemtime.ts \
../../../i18n/es/systemtime.ts \
../../../i18n/fr/systemtime.ts \
../../../i18n/hu/systemtime.ts \
../../../i18n/ja/systemtime.ts \
../../../i18n/ko/systemtime.ts \