~ubuntu-branches/ubuntu/trusty/kvirc/trusty-proposed

« back to all changes in this revision

Viewing changes to src/modules/theme/libkvitheme.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
//   File : libkvitheme.cpp
4
4
//   Creation date : Sat 30 Dec 2006 14:54:56 by Szymon Stefanek
5
5
//
6
 
//   This toolbar is part of the KVirc irc client distribution
7
 
//   Copyright (C) 2006-2008 Szymon Stefanek (pragma at kvirc dot net)
 
6
//   This toolbar is part of the KVIrc irc client distribution
 
7
//   Copyright (C) 2006-2010 Szymon Stefanek (pragma at kvirc dot net)
8
8
//
9
9
//   This program is FREE software. You can redistribute it and/or
10
10
//   modify it under the terms of the GNU General Public License
23
23
//=============================================================================
24
24
 
25
25
#include "managementdialog.h"
26
 
#include "themefunctions.h"
 
26
#include "ThemeFunctions.h"
27
27
 
28
 
#include "kvi_msgbox.h"
29
 
#include "kvi_module.h"
30
 
#include "kvi_locale.h"
31
 
#include "kvi_qstring.h"
32
 
#include "kvi_parameterlist.h"
33
 
#include "kvi_cmdformatter.h"
34
 
#include "kvi_error.h"
 
28
#include "KviMessageBox.h"
 
29
#include "KviModule.h"
 
30
#include "KviLocale.h"
 
31
#include "KviParameterList.h"
 
32
#include "KviCommandFormatter.h"
 
33
#include "KviError.h"
35
34
#include "kvi_out.h"
36
 
#include "kvi_iconmanager.h"
37
 
#include "kvi_mirccntrl.h"
38
 
#include "kvi_config.h"
 
35
#include "KviIconManager.h"
 
36
#include "KviConfigurationFile.h"
39
37
#include "kvi_sourcesdate.h"
40
 
#include "kvi_fileutils.h"
41
 
#include "kvi_filedialog.h"
42
 
#include "kvi_theme.h"
 
38
#include "KviFileUtils.h"
 
39
#include "KviFileDialog.h"
 
40
#include "KviTheme.h"
43
41
 
44
42
#include <QFileInfo>
45
43
#include <QMessageBox>
70
68
        KVSM_PARAMETERS_END(c)
71
69
 
72
70
        QString szError;
73
 
        if(!KviThemeFunctions::installThemePackage(szThemePackFile,szError))
 
71
        if(!ThemeFunctions::installThemePackage(szThemePackFile,szError))
74
72
        {
75
73
                c->error(__tr2qs_ctx("Error installing theme package: %Q","theme"),&szError);
76
74
                return false;
99
97
                KVSM_PARAMETER("package_name",KVS_PT_STRING,0,szThemePackFile)
100
98
        KVSM_PARAMETERS_END(c)
101
99
        QString szDir;
102
 
        g_pApp->getLocalKvircDirectory(szDir,KviApp::Themes);
 
100
        g_pApp->getLocalKvircDirectory(szDir,KviApplication::Themes);
103
101
        szDir += KVI_PATH_SEPARATOR_CHAR;
104
102
        szDir += szThemePackFile;
105
103
        KviThemeInfo * themeInfo = new KviThemeInfo();
118
116
                        if(!KviTheme::load(szPath,out))
119
117
                        {
120
118
                                QString szErr = out.lastError();
121
 
                                QString szMsg;
122
 
                                KviQString::sprintf(szMsg,__tr2qs_ctx("Failed to apply the specified theme: %Q","theme"),&szErr);
 
119
                                QString szMsg = QString(__tr2qs_ctx("Failed to apply the specified theme: %1","theme")).arg(szErr);
123
120
                                QMessageBox::critical(0,__tr2qs_ctx("Apply theme - KVIrc","theme"),szMsg,
124
121
                                QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
125
122
                        }
126
123
                }
127
124
        }
128
 
        c->warning(__tr2qs_ctx("The theme package '%Q' does not exists","theme"),&szThemePackFile);
 
125
        c->warning(__tr2qs_ctx("The theme package '%Q' does not exist","theme"),&szThemePackFile);
129
126
        return true;
130
127
}
131
128
/*
150
147
                KVSM_PARAMETER("package_name",KVS_PT_STRING,0,szThemePackFile)
151
148
        KVSM_PARAMETERS_END(c)
152
149
        QString szDir;
153
 
        g_pApp->getLocalKvircDirectory(szDir,KviApp::Themes);
 
150
        g_pApp->getLocalKvircDirectory(szDir,KviApplication::Themes);
154
151
        szDir += KVI_PATH_SEPARATOR_CHAR;
155
152
        szDir += szThemePackFile;
156
153
        KviThemeInfo * themeInfo = new KviThemeInfo();
168
165
                c->returnValue()->setHash(pHash);
169
166
                return true;
170
167
        }
171
 
        c->warning(__tr2qs_ctx("The theme package '%Q' does not exists","theme"),&szThemePackFile);
 
168
        c->warning(__tr2qs_ctx("The theme package '%Q' does not exist","theme"),&szThemePackFile);
172
169
        return true;
173
170
}
174
171
 
188
185
static bool theme_kvs_fnc_list(KviKvsModuleFunctionCall * c)
189
186
{
190
187
        QString szDir;
191
 
        g_pApp->getLocalKvircDirectory(szDir,KviApp::Themes);
 
188
        g_pApp->getLocalKvircDirectory(szDir,KviApplication::Themes);
192
189
        QDir d(szDir);
193
190
        QStringList sl = d.entryList(QDir::Dirs);
194
191
        QStringList szThemes;
245
242
                szFileName+=".png";
246
243
 
247
244
        QString szError;
248
 
        if(!KviThemeFunctions::makeKVIrcScreenshot(szFileName))
 
245
        if(!ThemeFunctions::makeKVIrcScreenshot(szFileName))
249
246
        {
250
247
                c->error(__tr2qs_ctx("Error making screenshot","theme")); // FIXME: a nicer error ?
251
248
                return false;
263
260
        @short:
264
261
                Shows the theme theme management editor
265
262
        @syntax:
266
 
                theme.dialog
 
263
                theme.dialog [-t]
267
264
        @description:
268
 
                Shows the theme theme management editor
 
265
                Shows the theme theme management editor[br]
 
266
                If the [-t] switch is used, the dialog is opened as toplevel window,
 
267
                otherwise it is opened as part of the current frame window.[br]
269
268
*/
270
269
 
271
 
static bool theme_kvs_cmd_dialog(KviKvsModuleCommandCall *)
 
270
static bool theme_kvs_cmd_dialog(KviKvsModuleCommandCall *c)
272
271
{
273
 
        KviThemeManagementDialog::display();
 
272
 
 
273
        ThemeManagementDialog::display(c->hasSwitch('t',"toplevel"));
274
274
        return true;
275
275
}
276
276
 
286
286
 
287
287
        QString szBuf;
288
288
        m->getDefaultConfigFileName(szBuf);
289
 
        KviConfig cfg(szBuf,KviConfig::Read);
 
289
        KviConfigurationFile cfg(szBuf,KviConfigurationFile::Read);
290
290
        g_rectManagementDialogGeometry = cfg.readRectEntry("EditorGeometry",QRect(10,10,390,440));
291
291
 
292
292
        return true;
294
294
 
295
295
static bool theme_module_cleanup(KviModule *m)
296
296
{
297
 
        KviThemeManagementDialog::cleanup();
 
297
        ThemeManagementDialog::cleanup();
298
298
 
299
299
        QString szBuf;
300
300
        m->getDefaultConfigFileName(szBuf);
301
 
        KviConfig cfg(szBuf,KviConfig::Write);
 
301
        KviConfigurationFile cfg(szBuf,KviConfigurationFile::Write);
302
302
        cfg.writeEntry("EditorGeometry",g_rectManagementDialogGeometry);
303
303
 
304
304
        return true;
306
306
 
307
307
static bool theme_module_can_unload(KviModule *)
308
308
{
309
 
        return (!KviThemeManagementDialog::instance());
 
309
        return (!ThemeManagementDialog::instance());
310
310
}
311
311
 
312
312