summaryrefslogtreecommitdiff
authorzecke <zecke>2002-09-15 21:46:39 (UTC)
committer zecke <zecke>2002-09-15 21:46:39 (UTC)
commit0b644b439bb8512de36384011dc6a275c0c7540c (patch) (unidiff)
tree106eb135e08838146a232ba12724a73ba9d61fb7
parentaead7682f97a416fae0b08b3a6582bc09551b5bc (diff)
downloadopie-0b644b439bb8512de36384011dc6a275c0c7540c.zip
opie-0b644b439bb8512de36384011dc6a275c0c7540c.tar.gz
opie-0b644b439bb8512de36384011dc6a275c0c7540c.tar.bz2
double items prob + qWarning output
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 09540bd..7decf8e 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -73,136 +73,138 @@ void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
73} 73}
74 74
75/** 75/**
76 * Initialises the owner field with the default value, the username 76 * Initialises the owner field with the default value, the username
77 */ 77 */
78void Today::setOwnerField() { 78void Today::setOwnerField() {
79 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 79 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
80 if ( QFile::exists( file ) ) { 80 if ( QFile::exists( file ) ) {
81 Contact cont = Contact::readVCard( file )[0]; 81 Contact cont = Contact::readVCard( file )[0];
82 QString returnString = cont.fullName(); 82 QString returnString = cont.fullName();
83 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 83 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
84 } else { 84 } else {
85 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 85 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
86 } 86 }
87} 87}
88 88
89/** 89/**
90 * Set the owner field with a given QString, for example per qcop. 90 * Set the owner field with a given QString, for example per qcop.
91 */ 91 */
92void Today::setOwnerField( QString &message ) { 92void Today::setOwnerField( QString &message ) {
93 if ( !message.isEmpty() ) { 93 if ( !message.isEmpty() ) {
94 OwnerField->setText( "<b>" + message + "</b>" ); 94 OwnerField->setText( "<b>" + message + "</b>" );
95 } 95 }
96} 96}
97 97
98 98
99/** 99/**
100 * Init stuff needed for today. Reads the config file. 100 * Init stuff needed for today. Reads the config file.
101 */ 101 */
102void Today::init() { 102void Today::init() {
103 103
104 QDate date = QDate::currentDate(); 104 QDate date = QDate::currentDate();
105 QString time = ( tr( date.toString() ) ); 105 QString time = ( tr( date.toString() ) );
106 106
107 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); 107 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
108 108
109 // read config 109 // read config
110 Config cfg( "today" ); 110 Config cfg( "today" );
111 111
112 cfg.setGroup( "Applets" ); 112 cfg.setGroup( "Applets" );
113 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 113 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
114} 114}
115 115
116 116
117/** 117/**
118 * Load the plugins 118 * Load the plugins
119 */ 119 */
120void Today::loadPlugins() { 120void Today::loadPlugins() {
121 121 qWarning("pluginList count %d", pluginList.count() );
122 QValueList<TodayPlugin>::Iterator tit; 122 QValueList<TodayPlugin>::Iterator tit;
123 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 123 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
124 (*tit).library->unload(); 124 (*tit).library->unload();
125 delete (*tit).library; 125 delete (*tit).library;
126 } 126 }
127 pluginList.clear();
127 128
128 QString path = QPEApplication::qpeDir() + "/plugins/today"; 129 QString path = QPEApplication::qpeDir() + "/plugins/today";
129 QDir dir( path, "lib*.so" ); 130 QDir dir( path, "lib*.so" );
130 131
131 QStringList list = dir.entryList(); 132 QStringList list = dir.entryList();
132 QStringList::Iterator it; 133 QStringList::Iterator it;
133 134
134 uint count = 0; 135 uint count = 0;
135 for ( it = list.begin(); it != list.end(); ++it ) { 136 for ( it = list.begin(); it != list.end(); ++it ) {
136 TodayPluginInterface *iface = 0; 137 TodayPluginInterface *iface = 0;
137 QLibrary *lib = new QLibrary( path + "/" + *it ); 138 QLibrary *lib = new QLibrary( path + "/" + *it );
138 139
139 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 140 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
140 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 141 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
141 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 142 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
142 qDebug( QString(*it).latin1() ); 143 qDebug( QString(*it).latin1() );
143 TodayPlugin plugin; 144 TodayPlugin plugin;
144 plugin.library = lib; 145 plugin.library = lib;
145 plugin.iface = iface; 146 plugin.iface = iface;
146 plugin.name = QString(*it).latin1(); 147 plugin.name = QString(*it).latin1();
147 148
148 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 149 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
149 plugin.active = true; 150 plugin.active = true;
150 } else { 151 } else {
151 plugin.active = false; 152 plugin.active = false;
152 } 153 }
153 plugin.guiPart = plugin.iface->guiPart(); 154 plugin.guiPart = plugin.iface->guiPart();
154 pluginList.append( plugin ); 155 pluginList.append( plugin );
155 count++; 156 count++;
156 } else { 157 } else {
157 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 158 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
158 delete lib; 159 delete lib;
159 } 160 }
160 } 161 }
162 qWarning("pluginList count end %d", pluginList.count() );
161} 163}
162 164
163 165
164/** 166/**
165 * Repaint method. Reread all fields. 167 * Repaint method. Reread all fields.
166 */ 168 */
167void Today::draw() { 169void Today::draw() {
168 170
169 if ( pluginLayout ) { 171 if ( pluginLayout ) {
170 delete pluginLayout; 172 delete pluginLayout;
171 } 173 }
172 pluginLayout = new QVBoxLayout( layout ); 174 pluginLayout = new QVBoxLayout( layout );
173 175
174 if ( pluginList.count() == 0 ) { 176 if ( pluginList.count() == 0 ) {
175 QLabel *noPlugins = new QLabel( this ); 177 QLabel *noPlugins = new QLabel( this );
176 noPlugins->setText( tr( "No plugins found" ) ); 178 noPlugins->setText( tr( "No plugins found" ) );
177 layout->addWidget( noPlugins ); 179 layout->addWidget( noPlugins );
178 return; 180 return;
179 } 181 }
180 182
181 uint count = 0; 183 uint count = 0;
182 TodayPlugin plugin; 184 TodayPlugin plugin;
183 for ( uint i = 0; i < pluginList.count(); i++ ) { 185 for ( uint i = 0; i < pluginList.count(); i++ ) {
184 plugin = pluginList[i]; 186 plugin = pluginList[i];
185 187
186 if ( plugin.active ) { 188 if ( plugin.active ) {
187 QHBoxLayout* plugLayout = new QHBoxLayout( this ); 189 QHBoxLayout* plugLayout = new QHBoxLayout( this );
188 QPixmap plugPix; 190 QPixmap plugPix;
189 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); 191 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
190 OClickableLabel* plugIcon = new OClickableLabel( this ); 192 OClickableLabel* plugIcon = new OClickableLabel( this );
191 plugIcon->setPixmap( plugPix ); 193 plugIcon->setPixmap( plugPix );
192 QScrollView* sv = new QScrollView( this ); 194 QScrollView* sv = new QScrollView( this );
193 QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() ); 195 QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() );
194 // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) ); 196 // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) );
195 sv->setMinimumHeight( plugin.guiPart->minHeight() ); 197 sv->setMinimumHeight( plugin.guiPart->minHeight() );
196 //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); 198 //sv->setMaximumHeight( plugin.guiPart->maxHeight() );
197 199
198 sv->setResizePolicy( QScrollView::AutoOneFit ); 200 sv->setResizePolicy( QScrollView::AutoOneFit );
199 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 201 sv->setHScrollBarMode( QScrollView::AlwaysOff );
200 sv->setFrameShape( QFrame::NoFrame ); 202 sv->setFrameShape( QFrame::NoFrame );
201 sv->addChild( plugWidget ); 203 sv->addChild( plugWidget );
202 204
203 plugLayout->addWidget( plugIcon, 0, AlignTop ); 205 plugLayout->addWidget( plugIcon, 0, AlignTop );
204 plugLayout->addWidget( sv, 0, AlignTop ); 206 plugLayout->addWidget( sv, 0, AlignTop );
205 plugLayout->setStretchFactor( plugIcon, 1 ); 207 plugLayout->setStretchFactor( plugIcon, 1 );
206 plugLayout->setStretchFactor( sv, 9 ); 208 plugLayout->setStretchFactor( sv, 9 );
207 pluginLayout->addLayout( plugLayout ); 209 pluginLayout->addLayout( plugLayout );
208 count++; 210 count++;