KVIrc  4.9.2
DeveloperAPIs
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
KviDefaultScriptManager Class Reference

The manager who handles the restoring of the default script. More...

#include <KviDefaultScript.h>

+ Inheritance diagram for KviDefaultScriptManager:

Public Member Functions

unsigned int count ()
 Returns the number of instances of the class. More...
 
bool isDefscriptUpToDate ()
 Checks if the local defscript is up to date. More...
 
 KviDefaultScriptManager ()
 Constructs the default script manager. More...
 
void load (const QString &szConfigFile)
 Loads the configuration of the default script. More...
 
void loadEmptyConfig ()
 Initilizes an empty configuration. More...
 
void restore ()
 Restores the default script. More...
 
void save (const QString &szConfigFile)
 Saves the configuration of the default script. More...
 
 ~KviDefaultScriptManager ()
 Destroys the default script manager. More...
 

Static Public Member Functions

static void done ()
 Destroys the class instance. More...
 
static void init ()
 Initializes the class instance. More...
 
static KviDefaultScriptManagerinstance ()
 Returns the instance of the class. More...
 

Private Member Functions

bool compareVersions (QString &szConfig, QString *pszError)
 Compares versions between global and personal data. More...
 
void loadInternal (KviConfigurationFile *pCfg)
 Loads the configuration of the default script. More...
 
void restoreInternal ()
 Restores the default script. More...
 
void saveInternal (KviConfigurationFile *pCfg)
 Saves the configuration of the default script. More...
 

Private Attributes

bool m_bConfigFileMissing
 
bool m_bNoNeedToRestore
 
KviDefaultScriptDialogm_pDialog
 
QString m_szAction
 
QString m_szAddon
 
QString m_szAlias
 
QString m_szClass
 
QString m_szDate
 
QString m_szEvent
 
QString m_szPopup
 
QString m_szRaw
 
QString m_szToolbar
 
QString m_szVersion
 

Static Private Attributes

static KviDefaultScriptManagerm_pSelf = nullptr
 
static unsigned int m_uCount = 0
 

Detailed Description

The manager who handles the restoring of the default script.

Constructor & Destructor Documentation

KviDefaultScriptManager::KviDefaultScriptManager ( )
KviDefaultScriptManager::~KviDefaultScriptManager ( )
default

Destroys the default script manager.

Member Function Documentation

bool KviDefaultScriptManager::compareVersions ( QString &  szConfig,
QString *  pszError 
)
private

Compares versions between global and personal data.

Parameters
szConfigThe global configuration file
pszErrorThe buffer containing errors
Returns
bool

References __tr2qs, CHECK, KviStringConversion::fromString(), m_bNoNeedToRestore, m_szAction, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, m_szVersion, KviConfigurationFile::Read, and KviConfigurationFile::readEntry().

Referenced by restore().

unsigned int KviDefaultScriptManager::count ( )
inline

Returns the number of instances of the class.

Returns
unsigned int

Referenced by done(), and init().

void KviDefaultScriptManager::done ( )
static

Destroys the class instance.

Returns
void

References count(), m_pSelf, and m_uCount.

Referenced by KviApplication::~KviApplication().

void KviDefaultScriptManager::init ( )
static

Initializes the class instance.

Returns
void

References count(), KviDefaultScriptManager(), m_pSelf, and m_uCount.

Referenced by KviApplication::setup().

static KviDefaultScriptManager* KviDefaultScriptManager::instance ( )
inlinestatic
bool KviDefaultScriptManager::isDefscriptUpToDate ( )
void KviDefaultScriptManager::load ( const QString &  szConfigFile)

Loads the configuration of the default script.

This is an external helper to the real function

Parameters
szConfigFileThe file where to load
Returns
void

References loadInternal(), and KviConfigurationFile::Read.

Referenced by KviApplication::setup().

void KviDefaultScriptManager::loadEmptyConfig ( )

Initilizes an empty configuration.

Returns
void

References m_szAction, m_szAddon, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, and m_szVersion.

Referenced by KviApplication::setup().

void KviDefaultScriptManager::loadInternal ( KviConfigurationFile pCfg)
private

Loads the configuration of the default script.

This is the real function

Parameters
pCfgThe configuration file
Returns
void

References IS_EMPTY, m_szAction, m_szAddon, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, m_szVersion, and KviConfigurationFile::readEntry().

Referenced by load().

void KviDefaultScriptManager::restore ( )

Restores the default script.

If this function is suggested by KVIrc, the default script will be wiped out and then it will be reloaded. Otherwise, when the user wants to restore it, he can choose which part of the default script have to be restored

This is an external helper to the real function

Returns
void

References __tr2qs, compareVersions(), KviApplication::DefScript, g_pApp, KviApplication::getGlobalKvircDirectory(), m_bNoNeedToRestore, m_pDialog, restoreInternal(), and KviMessageBox::warning().

Referenced by KviApplication::restoreDefaultScript().

void KviDefaultScriptManager::restoreInternal ( )
private
void KviDefaultScriptManager::save ( const QString &  szConfigFile)

Saves the configuration of the default script.

This is an external helper to the real function

Parameters
szConfigFileThe file to save
Returns
void

References KviConfigurationFile::clear(), saveInternal(), and KviConfigurationFile::Write.

Referenced by KviApplication::saveDefaultScripts().

void KviDefaultScriptManager::saveInternal ( KviConfigurationFile pCfg)
private

Saves the configuration of the default script.

This is the real function

Parameters
pCfgThe configuration file
Returns
void

References m_szAction, m_szAddon, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, m_szVersion, and KviConfigurationFile::writeEntry().

Referenced by save().

Member Data Documentation

bool KviDefaultScriptManager::m_bConfigFileMissing
private
bool KviDefaultScriptManager::m_bNoNeedToRestore
private
KviDefaultScriptDialog* KviDefaultScriptManager::m_pDialog
private

Referenced by restore(), and restoreInternal().

KviDefaultScriptManager * KviDefaultScriptManager::m_pSelf = nullptr
staticprivate

Referenced by done(), and init().

QString KviDefaultScriptManager::m_szAction
private
QString KviDefaultScriptManager::m_szAddon
private
QString KviDefaultScriptManager::m_szAlias
private
QString KviDefaultScriptManager::m_szClass
private
QString KviDefaultScriptManager::m_szDate
private
QString KviDefaultScriptManager::m_szEvent
private
QString KviDefaultScriptManager::m_szPopup
private
QString KviDefaultScriptManager::m_szRaw
private
QString KviDefaultScriptManager::m_szToolbar
private
QString KviDefaultScriptManager::m_szVersion
private
unsigned int KviDefaultScriptManager::m_uCount = 0
staticprivate

Referenced by done(), and init().


The documentation for this class was generated from the following files: