summaryrefslogtreecommitdiff
path: root/gui/Common/PkStrings.cpp
blob: 6b9ebf29adc17ae31279951295866f66038c9c7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
/***************************************************************************
 *   Copyright (C) 2008 by Daniel Nicoletti   *
 *   mirttex85-pk@yahoo.com.br   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <KLocale>

#include <KMessageBox>

#include "PkStrings.h"

PkStrings::PkStrings( QObject *parent )
 : QObject(parent)
{
}

PkStrings::~PkStrings()
{
}

QString PkStrings::StatusChanged(Status::Value v)
{
    switch (v) {
        case Status::Setup :
	    return i18n("Waiting for service to start");
        case Status::Wait :
	    return i18n("Waiting for other tasks");
        case Status::Query :
	    return i18n("Querying");
        case Status::Info :
	    return i18n("Getting information");
        case Status::Remove :
	    return i18n("Removing");
        case Status::Refresh_cache :
	    return i18n("Refreshing software list");
        case Status::Download :
	    return i18n("Downloading");
        case Status::Install :
	    return i18n("Installing");
        case Status::Update :
	    return i18n("Updating");
        case Status::Cleanup :
	    return i18n("Cleaning Up");
        case Status::Obsolete :
	    return i18n("Obsoletiong");
        case Status::Dep_resolve :
	    return i18n("Resolving dependencies");
        case Status::Rollback :
	    return i18n("Rolling back");
        case Status::Commit :
	    return i18n("Committing changes");
        case Status::Request :
	    return i18n("Requesting data");
        case Status::Finished :
	    return i18n("Finished");
        case Status::Cancel :
	    return i18n("Cancelling");
        case Status::Unknown :
	    return i18n("Unknown state");
	default :
	    return i18n("Running task");
    }
}

QString PkStrings::Error(Error::Value v)
{
    switch (v) {
	case Error::Oom :
	    return i18n("Out of memory");
	case Error::No_network :
	    return i18n("No network connection available");
	case Error::Not_supported :
	    return i18n("Not supported by this backend");
	case Error::Internal_error :
	    return i18n("An internal system error has occurred");
	case Error::Gpg_failure :
	    return i18n("A security trust relationship is not present");
	case Error::Package_id_invalid :
	    return i18n("The package identifier was not well formed");
	case Error::Package_not_installed :
	    return i18n("The package is not installed");
	case Error::Package_not_found :
	    return i18n("The package was not found");
	case Error::Package_already_installed :
	    return i18n("The package is already installed");
	case Error::Package_download_failed :
	    return i18n("The package download failed");
	case Error::Group_not_found :
	    return i18n("The group was not found");
	case Error::Group_list_invalid :
	    return i18n("The group list was invalid");
	case Error::Dep_resolution_failed :
	    return i18n("Dependency resolution failed");
	case Error::Filter_invalid :
	    return i18n("Search filter was invalid");
	case Error::Create_thread_failed :
	    return i18n("Failed to create a thread");
	case Error::Transaction_error :
	    return i18n("Transaction error");
	case Error::Transaction_cancelled :
	    return i18n("The task was canceled");
	case Error::No_cache :
	    return i18n("No package cache is available");
	case Error::Repo_not_found :
	    return i18n("Repository name was not found");
	case Error::Cannot_remove_system_package :
	    return i18n("Could not remove a protected system package");
	case Error::Process_kill :
	    return i18n("The task was forcibly canceled");
	case Error::Failed_initialization :
	    return i18n("Failed to initialize");
	case Error::Failed_finalise :
	    return i18n("Failed to finalise");
	case Error::Failed_config_parsing :
	    return i18n("Reading the config file failed");
	case Error::Cannot_cancel :
	    return i18n("The task cannot be cancelled");
	case Error::Cannot_getLock :
	    return i18n("Cannot get lock");
	case Error::No_packages_to_update :
	    return i18n("No packages to update");
	case Error::Cannot_write_repo_config :
	    return i18n("Cannot write repository configuration");
	case Error::Local_install_failed :
	    return i18n("Local install failed");
	case Error::Bad_gpg_signature :
	    return i18n("Bad GPG signature");
	case Error::Missing_gpg_signature :
	    return i18n("Missing GPG signature");
	case Error::Cannot_install_source_package :
	    return i18n("Source packages cannot be installed");
	case Error::Repo_configuration_error :
	    return i18n("Repository configuration invalid");
	case Error::No_license_agreement :
	    return i18n("The license agreement failed");
	case Error::File_conflicts :
	    return i18n("Local file conflict between packages");
	case Error::Repo_not_available :
	    return i18n("Problem connecting to a software source");
	case Error::Invalid_package_file :
	    return i18n("Invalid package file");
	case Error::Package_install_blocked :
	    return i18n("Package install blocked");
	case Error::Package_corrupt :
	    return i18n("Package is corrupt");
	case Error::Unknown :
	    return i18n("Unknown error");
	default :
	    return i18n("Unknown error");
    }
}

QString PkStrings::ErrorMessage(Error::Value v)
{
    switch (v) {
	case Error::Oom :
	    return i18n("The service that is responsible for handling user requests is out of memory.\n"
			"Please restart your computer.");
	case Error::No_network :
	    return i18n("There is no network connection available.\n"
			"Please check your connection settings and try again");
	case Error::Not_supported :
	    return i18n("The action is not supported by this backend.\n"
			"Please report a bug as this shouldn't have happened.");
	case Error::Internal_error :
	    return i18n("A problem that we were not expecting has occurred.\n"
			"Please report this bug with the error description.");
	case Error::Gpg_failure :
	    return i18n("A security trust relationship could not be made with software source.\n"
			"Please check your security settings.");
	case Error::Package_id_invalid :
	    return i18n("The package identifier was not well formed when sent to the server.\n"
			"This normally indicates an internal error and should be reported.");
	case Error::Package_not_installed :
	    return i18n("The package that is trying to be removed or updated is not already installed.");
	case Error::Package_not_found :
	    return i18n("The package that is being modified was not found on your system or in any software source.");
	case Error::Package_already_installed :
	    return i18n("The package that is trying to be installed is already installed.");
	case Error::Package_download_failed :
	    return i18n("The package download failed.\n"
			"Please check your network connectivity.");
	case Error::Group_not_found :
	    return i18n("The group type was not found.\n"
			"Please check your group list and try again.");
	case Error::Group_list_invalid :
	    return i18n("The group list could not be loaded.\n"
			"Refreshing your cache may help, although this is normally a software "
			"source error.");
	case Error::Dep_resolution_failed :
	    return i18n("A package could not be found that allows the task to complete.\n"
			"More information is available in the detailed report.");
	case Error::Filter_invalid :
	    return i18n("The search filter was not correctly formed.");
	case Error::Create_thread_failed :
	    return i18n("A thread could not be created to service the user request.");
	case Error::Transaction_error :
	    return i18n("An unspecified task error has occurred.\n"
			"More information is available in the detailed report.");
	case Error::Transaction_cancelled :
	    return i18n("The task was canceled successfully and no packages were changed.");
	case Error::No_cache :
	    return i18n("The package list needs to be rebuilt.\n"
			"This should have been done by the backend automatically.");
	case Error::Repo_not_found :
	    return i18n("The remote software source name was not found.\n"
			"You may need to enable an item in Software Sources.");
	case Error::Cannot_remove_system_package :
	    return i18n("Removing a protected system package is not alloed.");
	case Error::Process_kill :
	    return i18n("The task was canceled successfully and no packages were changed.\n"
			"The backend did not exit cleanly.");
	case Error::Failed_initialization :
	    return i18n("Failed to initialize packaging backend.\n"
			"This may occur if other packaging tools are being used simultaneously.");
	case Error::Failed_finalise :
	    return i18n("Failed to close down the backend instance.\n"
			"This error can normally be ignored.");
	case Error::Failed_config_parsing :
	    return i18n("The native package configuration file could not be opened.\n"
			"Please make sure configuration is valid.");
	case Error::Cannot_cancel :
	    return i18n("The task is not safe to be cancelled at this time.");
	case Error::Cannot_getLock :
	    return i18n("Cannot get the exclusive lock on the packaging backend.\n"
			"Please close any other legacy packaging tools that may be open.");
	case Error::No_packages_to_update :
	    return i18n("None of the selected packages could be updated.");
	case Error::Cannot_write_repo_config :
	    return i18n("The repository configuration could not be modified.");
	case Error::Local_install_failed :
	    return i18n("Installing the local file failed.\n"
			"More information is available in the detailed report.");
	case Error::Bad_gpg_signature :
	    return i18n("The package signature could not be verified.");
	case Error::Missing_gpg_signature :
	    return i18n("The package signature was missing and this package is untrusted.\n"
			"This package was not signed with a GPG key when created.");
	case Error::Cannot_install_source_package :
	    return i18n("Source packages are not normally installed this way.\n"
			"Check the extension of the file you are trying to install.");
	case Error::Repo_configuration_error :
	    return i18n("Repository configuration was invalid and could not be read.");
	case Error::No_license_agreement :
	    return i18n("The license agreement was not agreed to.\n"
			"To use this software you have to accept the license.");
	case Error::File_conflicts :
	    return i18n("Two packages provide the same file.\n"
			"This is usually due to mixing packages for different software sources.");
	case Error::Repo_not_available :
	    return i18n("There was a (possibly temporary) problem connecting to a software source\n"
			"Please check the detailed error for further details.");
	case Error::Invalid_package_file :
	    return i18n("The package you are attempting to install is not valid.\n"
			"The package file could be corrupt, or not a proper package.");
	case Error::Package_install_blocked :
	    return i18n("Installation of this package prevented by your packaging system's configuration.");
	case Error::Package_corrupt :
	    return i18n("The package that was downloaded is corrupt and needs to be downloaded again.");
	case Error::Unknown :
	    return i18n("Unknown error, please report a bug.\n"
			"More information is available in the detailed report.");
	default :
	    return i18n("Unknown error, please report a bug.\n"
			"More information is available in the detailed report.");
    }
}

QString PkStrings::Groups(Groups::Value v)
{
    switch (v) {
        case Groups::Accessibility :
	    return i18n("Accessibility");
        case Groups::Accessories :
	    return i18n("Accessories");
        case Groups::Admin_tools :
	    return i18n("Admin tools");
        case Groups::Communication :
	    return i18n("Communication");
        case Groups::Desktop_gnome :
	    return i18n("GNOME desktop");
        case Groups::Desktop_kde :
	    return i18n("KDE desktop");
        case Groups::Desktop_other :
	    return i18n("Other desktops");
        case Groups::Desktop_xfce :
	    return i18n("XFCE desktop");
        case Groups::Education :
	    return i18n("Education");
        case Groups::Fonts :
	    return i18n("Fonts");
        case Groups::Games :
	    return i18n("Games");
        case Groups::Graphics :
	    return i18n("Graphics");
        case Groups::Internet :
	    return i18n("Internet");
        case Groups::Legacy :
	    return i18n("Legacy");
        case Groups::Localization :
	    return i18n("Localization");
        case Groups::Maps :
	    return i18n("Maps");
        case Groups::Multimedia :
	    return i18n("Multimedia");
        case Groups::Network :
	    return i18n("Network");
        case Groups::Office :
	    return i18n("Office");
        case Groups::Other :
	    return i18n("Other");
        case Groups::Power_management :
	    return i18n("Power management");
        case Groups::Programming :
	    return i18n("Development");
        case Groups::Publishing :
	    return i18n("Publishing");
        case Groups::Repos :
	    return i18n("Software sources");
        case Groups::Security :
	    return i18n("Security");
        case Groups::Servers :
	    return i18n("Servers");
        case Groups::System :
	    return i18n("System");
        case Groups::Virtualization :
	    return i18n("Virtualization");
        case Groups::Unknown :
	    return i18n("Unknown group");
        default :
	    return i18n( "group unrecognised" );
    }
}

KIcon PkStrings::GroupsIcon(Groups::Value v)
{
    switch (v) {
        case Groups::Accessibility :
	    return KIcon("preferences-desktop-accessibility");
        case Groups::Accessories :
	    return KIcon("applications-accessories");
        case Groups::Admin_tools :
	    return KIcon("dialog-password");
        case Groups::Communication :
	    return KIcon("network-workgroup");//FIXME
        case Groups::Desktop_gnome :
	    return KIcon("user-desktop");//FIXME
        case Groups::Desktop_kde :
	    return KIcon("kde");
        case Groups::Desktop_other :
	    return KIcon("user-desktop");
        case Groups::Desktop_xfce :
	    return KIcon("user-desktop");//FIXME
        case Groups::Education :
	    return KIcon("applications-education");
        case Groups::Fonts :
	    return KIcon("preferences-desktop-font");
        case Groups::Games :
	    return KIcon("applications-games");
        case Groups::Graphics :
	    return KIcon("applications-graphics");
        case Groups::Internet :
	    return KIcon("applications-internet");
        case Groups::Legacy :
	    return KIcon("media-floppy");
        case Groups::Localization :
	    return KIcon("applications-education-language");
        case Groups::Maps :
	    return KIcon("Maps");//FIXME
        case Groups::Multimedia :
	    return KIcon("applications-multimedia");
        case Groups::Network :
	    return KIcon("network-wired");
        case Groups::Office :
	    return KIcon("applications-office");
        case Groups::Other :
	    return KIcon("applications-other");
        case Groups::Power_management :
	    return KIcon("battery");
        case Groups::Programming :
	    return KIcon("applications-development");
        case Groups::Publishing :
	    return KIcon("accessories-text-editor");
        case Groups::Repos :
	    return KIcon("application-x-compressed-tar");
        case Groups::Security :
	    return KIcon("security-high");
        case Groups::Servers :
	    return KIcon("network-server");
        case Groups::System :
	    return KIcon("applications-system");
        case Groups::Virtualization :
	    return KIcon("cpu");
        case Groups::Unknown :
	    return KIcon("unknown");
        default :
	    return KIcon("unknown");
    }
}

// void PkTransaction::Finished(Exit::Value status, uint /*runtime*/)
// {
//     qDebug() << "trans finished: " << status ;
//     switch(status) {
//         case Exit::Success :
// 	    qDebug() << "trans succes: ";
// 	    break;
// 	case Exit::Failed :
// 	    qDebug() << "trans failed: ";
//             m_notifyT.start(50);
// 	    break;
// 	case Exit::Kill :
//             qDebug() << "trans quit: ";
//             break;
// 	case Exit::Unknown :
//             qDebug() << "trans quit: ";
//             break;
//     }
// }

#include "PkStrings.moc"