messagingapp/msgsettings/msgsettingsplugin.deprecated/src/msgsettingsplugin.cpp
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: This is for Message Settings plugin for ControlPanel
       
    15  *
       
    16  */
       
    17 
       
    18 #include "msgsettingsplugin.h"
       
    19 #include "msgsettingsview.h"
       
    20 #include <cpsettingformentryitemdataimpl.h>
       
    21 #include <QFile>
       
    22 #include "debugtraces.h"
       
    23 
       
    24 #include <QDateTime>
       
    25 
       
    26 const QString debugFileName("c://ControlPanelSettings.txt");
       
    27 
       
    28 #ifdef _DEBUG_TRACES_
       
    29 void debugInit(QtMsgType type, const char *msg)
       
    30  {
       
    31  
       
    32 	QFile ofile(debugFileName);
       
    33     if (!ofile.open(QIODevice::Append | QIODevice::Text))
       
    34     {
       
    35         qFatal("error opening results file");
       
    36         return;
       
    37     }
       
    38     QDateTime dt = QDateTime::currentDateTime();
       
    39 
       
    40     QTextStream out(&ofile);
       
    41     switch (type)
       
    42     {
       
    43         case QtDebugMsg:
       
    44         out << " DEBUG:";
       
    45         out << msg;
       
    46         break;
       
    47         case QtWarningMsg:
       
    48         //out << " WARN:";
       
    49         //out << msg;
       
    50         break;
       
    51         case QtCriticalMsg:
       
    52         //out << "\n ";
       
    53         //out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap");
       
    54         //out << " CRITICAL:";
       
    55         //out << msg;
       
    56         break;
       
    57         case QtFatalMsg:
       
    58         //out << " FATAL:";
       
    59         //out << msg;
       
    60         //abort();
       
    61         break;
       
    62         default:
       
    63         //out << " No Log Selection Type:";
       
    64         //out << msg;
       
    65         break;
       
    66 
       
    67     }
       
    68  }
       
    69 #endif 
       
    70  
       
    71 MsgSettingsPlugin::MsgSettingsPlugin()
       
    72 {
       
    73 #ifdef _DEBUG_TRACES_
       
    74     //Debug Logs
       
    75 	  QFile ofile;
       
    76     if (ofile.exists(debugFileName))
       
    77     {
       
    78       ofile.remove(debugFileName);
       
    79     }
       
    80 
       
    81 		qInstallMsgHandler(debugInit);
       
    82 #endif		
       
    83 }
       
    84 
       
    85 MsgSettingsPlugin::~MsgSettingsPlugin()
       
    86 {
       
    87 
       
    88 }
       
    89 
       
    90 QList<CpSettingFormItemData*> MsgSettingsPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
       
    91 {
       
    92 		QDEBUG_WRITE("Enter MsgSettingsPlugin::createSettingFormItemData\n");
       
    93 
       
    94     return QList<CpSettingFormItemData*>() 
       
    95             << new CpSettingFormEntryItemDataImpl<MsgSettingsView>(
       
    96 			   itemDataHelper,
       
    97                tr("Messaging"), 
       
    98 			   tr("Message Settings"));
       
    99 }
       
   100 
       
   101 Q_EXPORT_PLUGIN2(msgsettingsplugin, MsgSettingsPlugin);