]>
cloud.milkyroute.net Git - dolphin.git/blob - src/views/rolesaccessor.cpp
1 /***************************************************************************
2 * Copyright (C) 2010 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "rolesaccessor.h"
25 class RolesAccessorSingleton
28 RolesAccessor instance
;
30 K_GLOBAL_STATIC(RolesAccessorSingleton
, s_rolesAccessor
)
32 RolesAccessor
& RolesAccessor::instance()
34 return s_rolesAccessor
->instance
;
37 QList
<QByteArray
> RolesAccessor::roles() const
42 QString
RolesAccessor::translation(const QByteArray
& role
) const
44 return i18nc(m_translation
[role
]->roleTranslationContext
, m_translation
[role
]->roleTranslation
);
47 RolesAccessor::RolesAccessor() :
51 static const RolesAccessor::Translation translations
[] = {
52 // role roleTranslationContext roleTranslation
53 { "name", I18N_NOOP2_NOSTRIP("@label", "Name") },
54 { "size", I18N_NOOP2_NOSTRIP("@label", "Size") },
55 { "date", I18N_NOOP2_NOSTRIP("@label", "Date") },
56 { "permissions", I18N_NOOP2_NOSTRIP("@label", "Permissions") },
57 { "owner", I18N_NOOP2_NOSTRIP("@label", "Owner") },
58 { "group", I18N_NOOP2_NOSTRIP("@label", "Group") },
59 { "type", I18N_NOOP2_NOSTRIP("@label", "Type") },
60 { "destination", I18N_NOOP2_NOSTRIP("@label", "Link Destination") },
61 { "path", I18N_NOOP2_NOSTRIP("@label", "Path") }
64 for (unsigned int i
= 0; i
< sizeof(translations
) / sizeof(Translation
); ++i
) {
65 m_translation
.insert(translations
[i
].role
, &translations
[i
]);
66 m_roles
.append(translations
[i
].role
);
70 RolesAccessor::~RolesAccessor()