controlpanelui/src/cpprofilewrapper/src/cpprofilemodel.cpp
changeset 33 0cfa53de576f
parent 19 36aa4756ee82
child 41 ab0490982943
equal deleted inserted replaced
29:313976a11e23 33:0cfa53de576f
    17 
    17 
    18 #include "cpprofilemodel.h"
    18 #include "cpprofilemodel.h"
    19 #include "cpprofilemodel_p.h"
    19 #include "cpprofilemodel_p.h"
    20 #include <QtCore/QStringList>
    20 #include <QtCore/QStringList>
    21 
    21 
       
    22 /*!
       
    23    Contructor
       
    24  */
    22 CpProfileModel::CpProfileModel(QObject *parent /*=0*/):QObject(parent),
    25 CpProfileModel::CpProfileModel(QObject *parent /*=0*/):QObject(parent),
    23                                                        d_ptr(new CpProfileModelPrivate())
    26                                                        d_ptr(new CpProfileModelPrivate())
    24 {
    27 {
    25     d_ptr->initialize(this);    
    28     d_ptr->initialize(this);    
    26 }
    29 }
    27 
    30 
       
    31 /*!
       
    32    Destrutor
       
    33  */
    28 CpProfileModel::~CpProfileModel()
    34 CpProfileModel::~CpProfileModel()
    29 {
    35 {
    30     delete d_ptr;
    36     delete d_ptr;
    31 }
    37 }
    32 
    38 
    33 /*
    39 /*!
    34  * Get the result of the initiation
    40    Get profile name with its id
    35  */
       
    36 int CpProfileModel::initiationFlag()
       
    37 {
       
    38     return d_ptr->initiationFlag();
       
    39 }
       
    40 
       
    41 /*
       
    42  * Get profile name with its id
       
    43  */
    41  */
    44 QString CpProfileModel::profileName(int profileId) const
    42 QString CpProfileModel::profileName(int profileId) const
    45 {
    43 {
    46     return d_ptr->profileName(profileId);
    44     return d_ptr->profileName(profileId);
    47 }
    45 }
    48 /*!
    46 /*!
    49  * get profile name list 
    47    get profile name list 
    50  */
    48  */
    51 QStringList CpProfileModel::profileNames()const
    49 QStringList CpProfileModel::profileNames()const
    52 {
    50 {
    53     return d_ptr->profileNames();
    51     return d_ptr->profileNames();
    54 }
    52 }
    55 /*
    53 /*!
    56  * Activate a profile with its id, return the operation code.
    54    Activate a profile with its id, return the result code.
    57  */
    55  */
    58 int CpProfileModel::activateProfile(int profileId)
    56 int CpProfileModel::activateProfile(int profileId)
    59 {
    57 {
    60     return d_ptr->activateProfile(profileId);
    58     return d_ptr->activateProfile(profileId);
    61 }
    59 }
    62 
    60 
    63 /*
    61 /*!
    64  * Get active profile's id
    62    Get active profile's id
    65  */
    63  */
    66 int CpProfileModel::activeProfileId() const
    64 int CpProfileModel::activeProfileId() const
    67 {
    65 {
    68     return d_ptr->activeProfileId();
    66     return d_ptr->activeProfileId();
    69 }
    67 }
    77 }
    75 }
    78 
    76 
    79 /*!
    77 /*!
    80      Set profile settings from center repository keys
    78      Set profile settings from center repository keys
    81  */
    79  */
    82 int CpProfileModel::setProfileSettings(int profileId, CpProfileSettings& profileSettings )
    80 void CpProfileModel::setProfileSettings(int profileId, CpProfileSettings& profileSettings )
    83 {
    81 {
    84     return d_ptr->setProfileSettings(profileId, profileSettings);
    82     return d_ptr->setProfileSettings(profileId, profileSettings);
    85 }
    83 }
    86 
    84 
    87 /*!
    85 /*!
    88      Get ring tone of profiles, if the general profile's ring tone is different with 
    86      Get ring tone of active profile
    89      meeting ring tone, it returns the general profile's ring tone
       
    90  */
    87  */
    91 QString CpProfileModel::ringTone() const
    88 QString CpProfileModel::ringTone() const
    92 {
    89 {
    93     return d_ptr->ringTone();
    90     return d_ptr->ringTone();
    94 }
    91 }
   100 {
    97 {
   101     d_ptr->setRingTone(filePath);
    98     d_ptr->setRingTone(filePath);
   102 }
    99 }
   103 
   100 
   104 /*!
   101 /*!
   105      Return master volume for device
   102      Return ringing volume of device
   106  */
   103  */
   107 int CpProfileModel::masterVolume() const
   104 int CpProfileModel::masterVolume() const
   108 {
   105 {
   109     return d_ptr->masterVolume();
   106     return d_ptr->masterVolume();
   110 }
   107 }
   111 
   108 
   112 /*!
   109 /*!
   113      Set device's master volume
   110      Set device's ringing volume
   114  */
   111  */
   115 void CpProfileModel::setMasterVolume(int volume)
   112 void CpProfileModel::setMasterVolume(int volume)
   116 {
   113 {
   117     return d_ptr->setMasterVolume(volume);
   114     return d_ptr->setMasterVolume(volume);
   118 }
   115 }
   124 {
   121 {
   125     return d_ptr->masterVibra();
   122     return d_ptr->masterVibra();
   126 }
   123 }
   127 
   124 
   128 /*!
   125 /*!
   129      Set the master vibra's status of device, if the master vibra is on,
   126      Set the master vibra's status of device
   130      the vibra settings in profiles are valid, if the master is off, the 
       
   131      vibra settings in profiles are invalid.
       
   132  */
   127  */
   133 void CpProfileModel::setMasterVibra(bool isVibra)
   128 void CpProfileModel::setMasterVibra(bool isVibra)
   134 {
   129 {
   135     d_ptr->setMasterVibra(isVibra);
   130     d_ptr->setMasterVibra(isVibra);
   136 }
   131 }
   137 
   132 
   138 /*!
   133 /*!
   139      Return the silence mode of device, silence mode will kill all outgoing 
   134      Return the silence mode of device
   140      audio.
       
   141  */
   135  */
   142 bool CpProfileModel::silenceMode() const
   136 bool CpProfileModel::silenceMode() const
   143 {
   137 {
   144     return d_ptr->silenceMode();
   138     return d_ptr->silenceMode();
   145 }
   139 }
   151 {
   145 {
   152     d_ptr->setSilenceMode(isSilence);
   146     d_ptr->setSilenceMode(isSilence);
   153 }
   147 }
   154 
   148 
   155 /*!
   149 /*!
   156      Return the status of off line mode (air plane mode) of device
   150    Get profile's ring tone, if the profile id is invalid, always return an empty string
   157  */
   151    \param profileId profile's id
   158 bool CpProfileModel::offLineMode() const
   152  */
   159 {
       
   160     return d_ptr->offLineMode();
       
   161 }
       
   162 
       
   163 /*!
       
   164      Set off line mode of device
       
   165  */
       
   166 void CpProfileModel::setOffLineMode(bool isOffLine)
       
   167 {
       
   168     d_ptr->setOffLineMode(isOffLine);
       
   169 }
       
   170 
       
   171 QString CpProfileModel::ringTone(int profileId)const
   153 QString CpProfileModel::ringTone(int profileId)const
   172 {
   154 {
   173     return d_ptr->ringTone(profileId);
   155     return d_ptr->ringTone(profileId);
   174 }
   156 }
   175 
   157 
       
   158 /*!
       
   159    Set ring tone for a profile, if the profile id is invalid, nothing happens
       
   160    \param profileId profile's id
       
   161    \param filePath ring tone's path
       
   162  */
   176 void CpProfileModel::setRingTone(int profileId, const QString& filePath)
   163 void CpProfileModel::setRingTone(int profileId, const QString& filePath)
   177 {
   164 {
   178     d_ptr->setRingTone(profileId, filePath);
   165     d_ptr->setRingTone(profileId, filePath);
   179 }
   166 }
   180 
   167 
       
   168 /*!
       
   169    Get message tone's name, if the profile id is invalid, always return an empty string
       
   170    \param profileId profile's id
       
   171  */
   181 QString CpProfileModel::messageTone(int profileId) const
   172 QString CpProfileModel::messageTone(int profileId) const
   182 {
   173 {
   183     return d_ptr->messageTone(profileId);
   174     return d_ptr->messageTone(profileId);
   184 }
   175 }
   185 
   176 
       
   177 /*!
       
   178    Set message tone for a profile, if the profile id is invalid, nothing happens
       
   179    \param profileId profile's id
       
   180    \param filePath message tone's path
       
   181  */
   186 void CpProfileModel::setMessageTone(int profileId, const QString& filePath)
   182 void CpProfileModel::setMessageTone(int profileId, const QString& filePath)
   187 {
   183 {
   188     d_ptr->setMessageTone(profileId, filePath);
   184     d_ptr->setMessageTone(profileId, filePath);
   189 }
   185 }
   190 
   186 
       
   187 /*!
       
   188    Get email tone's name, if the profile id is invalid, always return an empty string
       
   189    \param profileId profile's id
       
   190  */
   191 QString CpProfileModel::emailTone(int profileId) const
   191 QString CpProfileModel::emailTone(int profileId) const
   192 {
   192 {
   193     return d_ptr->emailTone(profileId);
   193     return d_ptr->emailTone(profileId);
   194 }
   194 }
   195 
   195 
       
   196 /*!
       
   197    Set email tone for a profile, if the profile id is invalid, nothing happens
       
   198    \param profileId profile's id
       
   199    \param filePath message tone's path
       
   200  */
   196 void CpProfileModel::setEmailTone(int profileId, const QString& filePath)
   201 void CpProfileModel::setEmailTone(int profileId, const QString& filePath)
   197 {
   202 {
   198     d_ptr->setEmailTone(profileId,filePath);
   203     d_ptr->setEmailTone(profileId,filePath);
   199 }
   204 }
   200 
   205 
       
   206 /*!
       
   207    Get reminder tone's name, if the profile id is invalid, always return an empty string
       
   208    \param profileId profile's id
       
   209  */
   201 QString CpProfileModel::reminderTone(int profileId) const
   210 QString CpProfileModel::reminderTone(int profileId) const
   202 {
   211 {
   203     return d_ptr->reminderTone(profileId);
   212     return d_ptr->reminderTone(profileId);
   204 }
   213 }
   205 
   214 
       
   215 /*!
       
   216    Set reminder tone for a profile, if the profile id is invalid, nothing happens
       
   217    \param profileId profile's id
       
   218    \param filePath reminder tone's path
       
   219  */
   206 void CpProfileModel::setReminderTone(int profileId, const QString& filePath)
   220 void CpProfileModel::setReminderTone(int profileId, const QString& filePath)
   207 {
   221 {
   208     d_ptr->setReminderTone(profileId,filePath);
   222     d_ptr->setReminderTone(profileId,filePath);
   209 }
   223 }
   210 
   224 
       
   225 /*!
       
   226    Get notification tone's status, if the profile id is invalid, always return false
       
   227    \param profileId profile's id
       
   228    \return return the status of notification tone, true value stands for the tone being on
       
   229  */
   211 bool CpProfileModel::notificationTone(int profileId) const
   230 bool CpProfileModel::notificationTone(int profileId) const
   212 {
   231 {
   213     return d_ptr->notificationTone(profileId);
   232     return d_ptr->notificationTone(profileId);
   214 }
   233 }
   215 
   234 
       
   235 /*!
       
   236    Set notification tone's status for a profile, if the profile id is invalid, nothing happens
       
   237    \param profileId profile's id
       
   238    \return isActive the status of notification tone
       
   239  */
   216 void CpProfileModel::setNotificationTone(int profileId, bool isActive)
   240 void CpProfileModel::setNotificationTone(int profileId, bool isActive)
   217 {
   241 {
   218     d_ptr->setNotificationTone(profileId, isActive);
   242     d_ptr->setNotificationTone(profileId, isActive);
   219 }
   243 }
   220 
   244 
       
   245 /*!
       
   246      Get key & touch screen tone's value, if the profile id is invalid, always return 0
       
   247  */
   221 int CpProfileModel::keyTouchScreenTone(int profileId) const
   248 int CpProfileModel::keyTouchScreenTone(int profileId) const
   222 {
   249 {
   223     return d_ptr->keyTouchScreenTone(profileId);
   250     return d_ptr->keyTouchScreenTone(profileId);
   224 }
   251 }
   225 
   252 
       
   253 /*!
       
   254      set key & touch screen tone, if the profile id is invalid, nothing happens
       
   255      \param profileId identify the profile
       
   256      \param level 0-5
       
   257  */
   226 void CpProfileModel::setKeyTouchScreenTone(int profileId, int level)
   258 void CpProfileModel::setKeyTouchScreenTone(int profileId, int level)
   227 {
   259 {
   228     d_ptr->setKeyTouchScreenTone(profileId,level);
   260     d_ptr->setKeyTouchScreenTone(profileId,level);
   229 }
   261 }
   230 
   262 
   231 bool CpProfileModel::ringAlertVibra(int profileId) const
   263 /*!
   232 {
   264    Get key & touch screen vibra's value, if the profile id is invalid, always return 0
   233     return d_ptr->ringAlertVibra(profileId);
   265    \param profileId identify the profile
   234 }
   266  */
   235 
   267 int CpProfileModel::keyTouchScreenVibra(int profileId) const
   236 void CpProfileModel::setRingAlertVibra(int profileId, bool isActive)
   268 {
   237 {
   269     return d_ptr->keyTouchScreenVibra(profileId);
   238     d_ptr->setRingAlertVibra(profileId,isActive);
   270 }
   239 }
   271 
   240 
   272 /*!
   241 bool CpProfileModel::messageVibra(int profileId) const
   273    Set key touch screen vibar for a profile, if the profile id is invalid, nothing happens
   242 {
   274    \param profileId identify the profile
   243     return d_ptr->messageVibra(profileId);
   275    \param level 0-5
   244 }
   276  */
   245 
       
   246 void CpProfileModel::setMessageVibra(int profileId, bool isActive)
       
   247 {
       
   248     return d_ptr->setMessageVibra(profileId,isActive);
       
   249 }
       
   250 
       
   251 bool CpProfileModel::emailVibra(int profileId) const
       
   252 {
       
   253     return d_ptr->emailVibra(profileId);
       
   254 }
       
   255 
       
   256 void CpProfileModel::setEmailVibra(int profileId, bool isActive)
       
   257 {
       
   258     d_ptr->setEmailVibra(profileId,isActive);    
       
   259 }
       
   260 
       
   261 bool CpProfileModel::reminderVibra(int profileId) const
       
   262 {
       
   263     return d_ptr->reminderVibra(profileId);
       
   264 }
       
   265 
       
   266 void CpProfileModel::setReminderVibra(int profileId, bool isActive)
       
   267 {
       
   268     d_ptr->setReminderVibra(profileId,isActive);    
       
   269 }
       
   270 
       
   271 bool CpProfileModel::notificationVibra(int profileId) const
       
   272 {
       
   273     return d_ptr->notificationVibra(profileId);
       
   274 }
       
   275 
       
   276 void CpProfileModel::setNotificationVibra(int profileId, bool isActive)
       
   277 {
       
   278     d_ptr->setNotificationVibra(profileId,isActive);
       
   279 }
       
   280 
       
   281 int CpProfileModel::keyTouchScreenVibra(int profileId)const
       
   282 {
       
   283     return  d_ptr->keyTouchScreenVibra(profileId);
       
   284 }
       
   285 
       
   286 void CpProfileModel::setKeyTouchScreenVibra(int profileId, int level)
   277 void CpProfileModel::setKeyTouchScreenVibra(int profileId, int level)
   287 {
   278 {
   288     d_ptr->setKeyTouchScreenVibra(profileId,level);
   279     d_ptr->setKeyTouchScreenVibra(profileId,level);
   289 }
   280 }
   290 
   281 
   291 ///*
       
   292 // * Set a profile as current editing profile
       
   293 // */
       
   294 //int CpProfileModel::setEditingProfile(int profileId)
       
   295 //{
       
   296 //    return d_ptr->setEditingProfile(profileId);
       
   297 //}
       
   298 //
       
   299 ///*
       
   300 // * Get path and file name of ring tone file
       
   301 // */
       
   302 //QString CpProfileModel::ringTone()
       
   303 //{
       
   304 //    return d_ptr->ringTone();
       
   305 //}
       
   306 //
       
   307 ///*
       
   308 // * Set path and file to ring tone
       
   309 // */
       
   310 //int CpProfileModel::setRingTone(const QString& filePath)
       
   311 //{
       
   312 //    int err = d_ptr->setRingTone(filePath);
       
   313 //	return err;
       
   314 //}
       
   315 //
       
   316 ///*
       
   317 // * Get path and file name of message tone file
       
   318 // */
       
   319 //QString CpProfileModel::messageTone()
       
   320 //{
       
   321 //    return d_ptr->messageTone();
       
   322 //}
       
   323 //
       
   324 ///*
       
   325 // * Set path and file to message tone
       
   326 // */
       
   327 //int CpProfileModel::setMessageTone(const QString& filePath)
       
   328 //{
       
   329 //    int err = d_ptr->setMessageTone(filePath);
       
   330 //	return err;
       
   331 //}
       
   332 //
       
   333 ///*
       
   334 // * Get path and file name of email tone file
       
   335 // */
       
   336 //QString CpProfileModel::emailTone()
       
   337 //{
       
   338 //    return d_ptr->emailTone();
       
   339 //}
       
   340 //
       
   341 ///*
       
   342 // * Set path and file to email tone
       
   343 // */
       
   344 //int CpProfileModel::setEmailTone(const QString& filePath)
       
   345 //{
       
   346 //    int err = d_ptr->setEmailTone(filePath);
       
   347 //	return err;
       
   348 //}
       
   349 //
       
   350 ///*
       
   351 // * Get path and file name of calendar event tone file
       
   352 // */
       
   353 //QString CpProfileModel::calendarTone()
       
   354 //{
       
   355 //    return d_ptr->calendarTone();
       
   356 //}
       
   357 //
       
   358 ///*
       
   359 // * Set path and file to calendar event tone
       
   360 // */
       
   361 //void CpProfileModel::setCalendarTone(const QString& filePath)
       
   362 //{
       
   363 //    d_ptr->setCalendarTone(filePath);
       
   364 //}
       
   365 //
       
   366 ///*
       
   367 // * Get path and file name of clock alarm tone file
       
   368 // */
       
   369 //QString CpProfileModel::alarmTone()
       
   370 //{
       
   371 //    return d_ptr->alarmTone();
       
   372 //}
       
   373 //
       
   374 ///*
       
   375 // * Set path and file to clock alarm tone
       
   376 // */
       
   377 //void CpProfileModel::setAlarmTone(const QString& filePath)
       
   378 //{
       
   379 //    d_ptr->setAlarmTone(filePath);
       
   380 //}
       
   381 //
       
   382 ///*
       
   383 // * Get the value of master volume
       
   384 // */
       
   385 //int CpProfileModel::ringVolume()
       
   386 //{
       
   387 //    return d_ptr->ringVolume();
       
   388 //}
       
   389 //
       
   390 ///*
       
   391 // * Set master volume, the value should be between 1-10
       
   392 // */
       
   393 //void CpProfileModel::setRingVolume(int volume)
       
   394 //{
       
   395 //    d_ptr->setRingVolume(volume);
       
   396 //}
       
   397 //
       
   398 ///*
       
   399 // * Activate master volume to beep
       
   400 // */
       
   401 //void CpProfileModel::activateBeep()
       
   402 //{
       
   403 //    d_ptr->activateBeep();
       
   404 //}
       
   405 //
       
   406 ///*
       
   407 // * Get beep status in master volume
       
   408 // */
       
   409 //bool CpProfileModel::isBeep()
       
   410 //{
       
   411 //    return d_ptr->isBeep();
       
   412 //}
       
   413 //
       
   414 ///*
       
   415 // * Activate master volume to silent
       
   416 // */
       
   417 //void CpProfileModel::activateSilent()
       
   418 //{
       
   419 //    d_ptr->activateSilent();
       
   420 //}
       
   421 //
       
   422 ///*
       
   423 // * Get silent status in master volume
       
   424 // */
       
   425 //bool CpProfileModel::isSilent()
       
   426 //{
       
   427 //    return d_ptr->isSilent();
       
   428 //}
       
   429 //
       
   430 ///*
       
   431 // * Get master vibra's status
       
   432 // */
       
   433 //bool CpProfileModel::vibraStatus()
       
   434 //{
       
   435 //    return d_ptr->vibraStatus();
       
   436 //}
       
   437 //
       
   438 ///*
       
   439 // * Set master vibra's status
       
   440 // */
       
   441 //void CpProfileModel::setVibraStatus(bool status)
       
   442 //{
       
   443 //    d_ptr->setVibraStatus(status);
       
   444 //}
       
   445 //
       
   446 ///*
       
   447 // * Get keypad' volume
       
   448 // */
       
   449 //int CpProfileModel::keyVolume()
       
   450 //{
       
   451 //    return d_ptr->keyVolume();
       
   452 //}
       
   453 //
       
   454 ///*
       
   455 // * Set keypad's volume, 
       
   456 // * the value of the volume should be between 0-3
       
   457 // */
       
   458 //void CpProfileModel::setKeyVolume(int volume)
       
   459 //{
       
   460 //    d_ptr->setKeyVolume(volume);
       
   461 //}
       
   462 //
       
   463 ///*
       
   464 // * Get screen tone's volume
       
   465 // */
       
   466 //int CpProfileModel::screenVolume()
       
   467 //{
       
   468 //    return d_ptr->screenVolume();
       
   469 //}
       
   470 //
       
   471 ///*
       
   472 // * Set screen tone's volume, 
       
   473 // * the value of the volume should be between 0-3
       
   474 // */
       
   475 //void CpProfileModel::setScreenVolume(int volume)
       
   476 //{
       
   477 //    d_ptr->setScreenVolume(volume);
       
   478 //}
       
   479 //
       
   480 ///*
       
   481 // * Get screen vibra's level
       
   482 // */
       
   483 //int CpProfileModel::screenVibra()
       
   484 //{
       
   485 //    return d_ptr->screenVibra();
       
   486 //}
       
   487 //
       
   488 ///*
       
   489 // * Set screen vibra's level, 
       
   490 // * the value of the level should be between 0-3
       
   491 // */
       
   492 //void CpProfileModel::setScreenVibra(int volume)
       
   493 //{
       
   494 //    d_ptr->setScreenVibra(volume);
       
   495 //}
       
   496 
       
   497 // End of file
   282 // End of file
   498 
   283