Diffstat (limited to 'noncore/styles/theme/plugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/styles/theme/plugin.cpp | 118 |
1 files changed, 105 insertions, 13 deletions
diff --git a/noncore/styles/theme/plugin.cpp b/noncore/styles/theme/plugin.cpp index b334357..4383693 100644 --- a/noncore/styles/theme/plugin.cpp +++ b/noncore/styles/theme/plugin.cpp | |||
@@ -1,19 +1,111 @@ | |||
1 | //#include <klocale.h> | ||
2 | #include "othemestyle.h" | 1 | #include "othemestyle.h" |
2 | #include "themeset.h" | ||
3 | #include "plugin.h" | ||
3 | 4 | ||
4 | extern "C" | 5 | |
6 | |||
7 | ThemeInterface::ThemeInterface ( ) : ref ( 0 ) | ||
5 | { | 8 | { |
6 | QStyle * allocate() { | 9 | } |
7 | return new OThemeStyle ( "" ); | 10 | |
8 | } | 11 | ThemeInterface::~ThemeInterface ( ) |
9 | int minor_version() { | 12 | { |
10 | return 0; | 13 | } |
11 | } | 14 | |
12 | int major_version() { | 15 | QStyle *ThemeInterface::create ( ) |
13 | return 1; | 16 | { |
14 | } | 17 | return new OThemeStyle ( "" ); |
15 | const char * description() { | 18 | } |
16 | return ( "Theme Style" ); | 19 | |
20 | QString ThemeInterface::name ( ) | ||
21 | { | ||
22 | return QObject::tr( "Themed style", "name" ); | ||
23 | } | ||
24 | |||
25 | QString ThemeInterface::description ( ) | ||
26 | { | ||
27 | return QObject::tr( "KDE2 theme compatible style engine", "description" ); | ||
28 | } | ||
29 | |||
30 | QCString ThemeInterface::key ( ) | ||
31 | { | ||
32 | return QCString ( "theme" ); | ||
33 | } | ||
34 | |||
35 | unsigned int ThemeInterface::version ( ) | ||
36 | { | ||
37 | return 100; // 1.0.0 (\d+.\d.\d) | ||
38 | } | ||
39 | |||
40 | QRESULT ThemeInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
41 | { | ||
42 | static ThemeSettingsInterface *setiface = 0; | ||
43 | |||
44 | *iface = 0; | ||
45 | |||
46 | if ( uuid == IID_QUnknown ) | ||
47 | *iface = this; | ||
48 | else if ( uuid == IID_Style ) | ||
49 | *iface = this; | ||
50 | else if ( uuid == IID_StyleSettings ) { | ||
51 | if ( !setiface ) | ||
52 | setiface = new ThemeSettingsInterface ( ); | ||
53 | *iface = setiface; | ||
17 | } | 54 | } |
55 | |||
56 | if ( *iface ) | ||
57 | (*iface)-> addRef ( ); | ||
58 | |||
59 | return QS_OK; | ||
60 | } | ||
61 | |||
62 | Q_EXPORT_INTERFACE() | ||
63 | { | ||
64 | Q_CREATE_INSTANCE( ThemeInterface ) | ||
65 | } | ||
66 | |||
67 | |||
68 | ThemeSettingsInterface::ThemeSettingsInterface ( ) : ref ( 0 ) | ||
69 | { | ||
70 | m_widget = 0; | ||
71 | } | ||
72 | |||
73 | ThemeSettingsInterface::~ThemeSettingsInterface ( ) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | QWidget *ThemeSettingsInterface::create ( QWidget *parent, const char *name ) | ||
78 | { | ||
79 | m_widget = new ThemeSettings ( parent, name ? name : "THEME-SETTINGS" ); | ||
80 | |||
81 | return m_widget; | ||
82 | } | ||
83 | |||
84 | bool ThemeSettingsInterface::accept ( ) | ||
85 | { | ||
86 | if ( !m_widget ) | ||
87 | return false; | ||
88 | |||
89 | return m_widget-> writeConfig ( ); | ||
90 | } | ||
91 | |||
92 | void ThemeSettingsInterface::reject ( ) | ||
93 | { | ||
94 | } | ||
95 | |||
96 | QRESULT ThemeSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
97 | { | ||
98 | *iface = 0; | ||
99 | |||
100 | |||
101 | if ( uuid == IID_QUnknown ) | ||
102 | *iface = this; | ||
103 | else if ( uuid == IID_StyleSettings ) | ||
104 | *iface = this; | ||
105 | |||
106 | if ( *iface ) | ||
107 | (*iface)-> addRef ( ); | ||
108 | |||
109 | return QS_OK; | ||
18 | } | 110 | } |
19 | 111 | ||