messagingapp/msgservices/msgserviceapp/src/main.cpp
author hgs
Tue, 29 Jun 2010 23:42:47 +0530
changeset 38 4e4b6adb1024
parent 37 518b245aa84c
child 46 b1f0785c289d
permissions -rw-r--r--
201025_01
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: Messaging service application startup main().
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include <hbapplication.h>
hgs
parents:
diff changeset
    19
#include <QTranslator>
hgs
parents:
diff changeset
    20
#include <QLocale>
hgs
parents:
diff changeset
    21
#include <QFile>
hgs
parents:
diff changeset
    22
#include <QPointer>
hgs
parents:
diff changeset
    23
#include <QDateTime>
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include "msgservicewindow.h"
hgs
parents:
diff changeset
    26
#include "debugtraces.h"
hgs
parents:
diff changeset
    27
hgs
parents:
diff changeset
    28
//Localised constants
hgs
parents:
diff changeset
    29
#define LOC_TITLE hbTrId("txt_messaging_title_messaging")
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
const QString debugFileName("c:/msgservice_app.txt");
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
#ifdef _DEBUG_TRACES_
hgs
parents:
diff changeset
    34
void debugInit(QtMsgType type, const char *msg)
hgs
parents:
diff changeset
    35
{
hgs
parents:
diff changeset
    36
hgs
parents:
diff changeset
    37
    QFile ofile(debugFileName);
hgs
parents:
diff changeset
    38
    if (!ofile.open(QIODevice::Append | QIODevice::Text))
hgs
parents:
diff changeset
    39
    {
hgs
parents:
diff changeset
    40
        qFatal("error opening results file");
hgs
parents:
diff changeset
    41
        return;
hgs
parents:
diff changeset
    42
    }
hgs
parents:
diff changeset
    43
    QDateTime dt = QDateTime::currentDateTime();
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
    QTextStream out(&ofile);
hgs
parents:
diff changeset
    46
    switch (type)
hgs
parents:
diff changeset
    47
    {
hgs
parents:
diff changeset
    48
        case QtDebugMsg:
hgs
parents:
diff changeset
    49
            out << " DEBUG:";
hgs
parents:
diff changeset
    50
            out << msg;
hgs
parents:
diff changeset
    51
            break;
hgs
parents:
diff changeset
    52
        case QtWarningMsg:
hgs
parents:
diff changeset
    53
            out << " WARN:";
hgs
parents:
diff changeset
    54
            out << msg;
hgs
parents:
diff changeset
    55
            break;
hgs
parents:
diff changeset
    56
        case QtCriticalMsg:
hgs
parents:
diff changeset
    57
            out << "\n ";
hgs
parents:
diff changeset
    58
            out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap");
hgs
parents:
diff changeset
    59
            out << " CRITICAL:";
hgs
parents:
diff changeset
    60
            out << msg;
hgs
parents:
diff changeset
    61
            break;
hgs
parents:
diff changeset
    62
        case QtFatalMsg:
hgs
parents:
diff changeset
    63
            out << " FATAL:";
hgs
parents:
diff changeset
    64
            out << msg;
hgs
parents:
diff changeset
    65
            abort();
hgs
parents:
diff changeset
    66
            break;
hgs
parents:
diff changeset
    67
        default:
hgs
parents:
diff changeset
    68
            out << " No Log Selection Type:";
hgs
parents:
diff changeset
    69
            out << msg;
hgs
parents:
diff changeset
    70
            break;
hgs
parents:
diff changeset
    71
hgs
parents:
diff changeset
    72
    }
hgs
parents:
diff changeset
    73
}
hgs
parents:
diff changeset
    74
#endif
hgs
parents:
diff changeset
    75
hgs
parents:
diff changeset
    76
int main(int argc, char **argv)
hgs
parents:
diff changeset
    77
{
hgs
parents:
diff changeset
    78
    HbApplication app( argc, argv );
hgs
parents:
diff changeset
    79
    
hgs
parents:
diff changeset
    80
    //TODO: Uncomment the lines when actual 
hgs
parents:
diff changeset
    81
    //translation files are available in sdk and remove loading locally.
hgs
parents:
diff changeset
    82
    QString locale = QLocale::system().name();
hgs
parents:
diff changeset
    83
    QString path = "z:/resource/qt/translations/";
hgs
parents:
diff changeset
    84
    QTranslator translator;
hgs
parents:
diff changeset
    85
    //QTranslator translator_comm;
hgs
parents:
diff changeset
    86
    //translator.load(path + QString("messaging_") + locale);
hgs
parents:
diff changeset
    87
    //translator_comm.load(path + QString("common_") + locale);
hgs
parents:
diff changeset
    88
    translator.load( "messaging_en_GB", ":/translations" );
hgs
parents:
diff changeset
    89
    app.installTranslator(&translator);
hgs
parents:
diff changeset
    90
    //app.installTranslator(&translator_comm);
hgs
parents:
diff changeset
    91
hgs
parents:
diff changeset
    92
    app.setApplicationName(LOC_TITLE);
hgs
parents:
diff changeset
    93
    
hgs
parents:
diff changeset
    94
    QPointer<MsgServiceWindow> window = new MsgServiceWindow();
hgs
parents:
diff changeset
    95
    window->show();
hgs
parents:
diff changeset
    96
    
hgs
parents:
diff changeset
    97
    int rv = app.exec();
hgs
parents:
diff changeset
    98
    delete window;
hgs
parents:
diff changeset
    99
    return rv;
hgs
parents:
diff changeset
   100
}
hgs
parents:
diff changeset
   101