KVIrc
4.9.2
DeveloperAPIs
|
The manager who handles the restoring of the default script. More...
#include <KviDefaultScript.h>
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 KviDefaultScriptManager * | instance () |
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 |
KviDefaultScriptDialog * | m_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 KviDefaultScriptManager * | m_pSelf = nullptr |
static unsigned int | m_uCount = 0 |
The manager who handles the restoring of the default script.
KviDefaultScriptManager::KviDefaultScriptManager | ( | ) |
Constructs the default script manager.
References KviApplication::Config, KviMemory::copy(), KviApplication::DefScript, KviApplication::firstTimeRun(), g_pApp, KviApplication::getGlobalKvircDirectory(), KviApplication::getLocalKvircDirectory(), m_bConfigFileMissing, and m_bNoNeedToRestore.
Referenced by init().
|
default |
Destroys the default script manager.
|
private |
Compares versions between global and personal data.
szConfig | The global configuration file |
pszError | The buffer containing errors |
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().
|
inline |
|
static |
Destroys the class instance.
References count(), m_pSelf, and m_uCount.
Referenced by KviApplication::~KviApplication().
|
static |
Initializes the class instance.
References count(), KviDefaultScriptManager(), m_pSelf, and m_uCount.
Referenced by KviApplication::setup().
|
inlinestatic |
Returns the instance of the class.
Referenced by KviApplication::checkSuggestRestoreDefaultScript(), KviApplication::restoreDefaultScript(), KviApplication::saveDefaultScripts(), and KviApplication::setup().
bool KviDefaultScriptManager::isDefscriptUpToDate | ( | ) |
Checks if the local defscript is up to date.
References KviApplication::DefScript, KviStringConversion::fromString(), g_pApp, KviApplication::getGlobalKvircDirectory(), m_bConfigFileMissing, m_szDate, KviConfigurationFile::Read, and KviConfigurationFile::readEntry().
void KviDefaultScriptManager::load | ( | const QString & | szConfigFile | ) |
Loads the configuration of the default script.
This is an external helper to the real function
szConfigFile | The file where to load |
References loadInternal(), and KviConfigurationFile::Read.
Referenced by KviApplication::setup().
void KviDefaultScriptManager::loadEmptyConfig | ( | ) |
Initilizes an empty configuration.
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().
|
private |
Loads the configuration of the default script.
This is the real function
pCfg | The configuration file |
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
References __tr2qs, compareVersions(), KviApplication::DefScript, g_pApp, KviApplication::getGlobalKvircDirectory(), m_bNoNeedToRestore, m_pDialog, restoreInternal(), and KviMessageBox::warning().
Referenced by KviApplication::restoreDefaultScript().
|
private |
Restores the default script.
This is the real function
References KviCustomToolBarManager::clear(), KviKvs::clearAliases(), KviKvs::clearAppEvents(), KviKvs::clearPopups(), KviKvs::clearRawEvents(), KviKvs::clearScriptAddons(), KviApplication::DefScript, g_pApp, KviApplication::getGlobalKvircDirectory(), KviCustomToolBarManager::instance(), KviActionManager::instance(), KviActionManager::killAllKvsUserActions(), KviApplication::loadDefaultScript(), KviDefaultScriptDialog::m_pAction, KviDefaultScriptDialog::m_pAddon, KviDefaultScriptDialog::m_pAlias, KviDefaultScriptDialog::m_pAll, KviDefaultScriptDialog::m_pClass, KviDefaultScriptDialog::m_pData, m_pDialog, KviDefaultScriptDialog::m_pEvent, KviDefaultScriptDialog::m_pPopup, KviDefaultScriptDialog::m_pRaw, KviDefaultScriptDialog::m_pToolbar, m_szAction, m_szAddon, m_szAlias, m_szClass, m_szDate, m_szEvent, m_szPopup, m_szRaw, m_szToolbar, m_szVersion, KviConfigurationFile::Read, and KviConfigurationFile::readEntry().
Referenced by restore().
void KviDefaultScriptManager::save | ( | const QString & | szConfigFile | ) |
Saves the configuration of the default script.
This is an external helper to the real function
szConfigFile | The file to save |
References KviConfigurationFile::clear(), saveInternal(), and KviConfigurationFile::Write.
Referenced by KviApplication::saveDefaultScripts().
|
private |
Saves the configuration of the default script.
This is the real function
pCfg | The configuration file |
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().
|
private |
Referenced by isDefscriptUpToDate(), and KviDefaultScriptManager().
|
private |
Referenced by compareVersions(), KviDefaultScriptManager(), and restore().
|
private |
Referenced by restore(), and restoreInternal().
|
staticprivate |
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), isDefscriptUpToDate(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().
|
private |
Referenced by compareVersions(), loadEmptyConfig(), loadInternal(), restoreInternal(), and saveInternal().