summaryrefslogtreecommitdiff
authorzecke <zecke>2004-02-05 15:57:13 (UTC)
committer zecke <zecke>2004-02-05 15:57:13 (UTC)
commit823399a552c04821fb0b49d816d733fa21a12a21 (patch) (unidiff)
treea5683ede5436c6b912a89d4ccc6cd63953214ea4
parent8cb0ae68f155c989cb9533c1f04d04ec64083708 (diff)
downloadopie-823399a552c04821fb0b49d816d733fa21a12a21.zip
opie-823399a552c04821fb0b49d816d733fa21a12a21.tar.gz
opie-823399a552c04821fb0b49d816d733fa21a12a21.tar.bz2
Stop trying to scale a null image
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/startmenu.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index f17c7f8..b84eed8 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -127,54 +127,56 @@ void StartMenu::itemSelected( int id )
127 if ( appLnk ) { 127 if ( appLnk ) {
128 appLnk->execute(); 128 appLnk->execute();
129 } 129 }
130 } else { 130 } else {
131 QString *tabName = tabNames.find( id ); 131 QString *tabName = tabNames.find( id );
132 if ( tabName ) { 132 if ( tabName ) {
133 emit tabSelected( *tabName ); 133 emit tabSelected( *tabName );
134 } 134 }
135 } 135 }
136} 136}
137 137
138void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file ) 138void StartMenu::createAppEntry( QPopupMenu *menu, QDir dir, QString file )
139{ 139{
140 if ( file.right(8) == ".desktop" ) { 140 if ( file.right(8) == ".desktop" ) {
141 AppLnk* applnk = new AppLnk( dir.path() + "/" + file ); 141 AppLnk* applnk = new AppLnk( dir.path() + "/" + file );
142 if ( !applnk->isValid() ) { 142 if ( !applnk->isValid() ) {
143 delete applnk; 143 delete applnk;
144 return; 144 return;
145 } 145 }
146 146
147 if ( applnk->type() == "Separator" ) { // No tr 147 if ( applnk->type() == "Separator" ) { // No tr
148 menu->insertSeparator(); 148 menu->insertSeparator();
149 delete applnk; 149 delete applnk;
150 } else { 150 } else {
151 QPixmap test; 151 QPixmap test;
152 test.convertFromImage( 152 QImage img = Resource::loadImage( applnk->icon() );
153 Resource::loadImage( applnk->icon() ).smoothScale( 153 if(!img.isNull() )
154 AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 ); 154 test.convertFromImage(
155 155 img.smoothScale(
156 menu->insertItem( test, applnk->name(), 156 AppLnk::smallIconSize(), AppLnk::smallIconSize() ), 0 );
157
158 menu->insertItem( test, applnk->name(),
157 currentItem + APPLNK_ID_OFFSET ); 159 currentItem + APPLNK_ID_OFFSET );
158 appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk ); 160 appLnks.insert( currentItem + APPLNK_ID_OFFSET, applnk );
159 currentItem++; 161 currentItem++;
160 } 162 }
161 } 163 }
162 164
163} 165}
164 166
165void StartMenu::createDirEntry( QPopupMenu *menu, QDir dir, QString file, bool lot ) 167void StartMenu::createDirEntry( QPopupMenu *menu, QDir dir, QString file, bool lot )
166{ 168{
167 // do some sanity checks and collect information 169 // do some sanity checks and collect information
168 170
169 if ( file == "." || file == ".." ) return; 171 if ( file == "." || file == ".." ) return;
170 172
171 Config cfg( dir.path() + "/" + file + "/.directory", Config::File ); 173 Config cfg( dir.path() + "/" + file + "/.directory", Config::File );
172 if ( !cfg.isValid() ) return; 174 if ( !cfg.isValid() ) return;
173 175
174 QString name = cfg.readEntry( "Name" ); 176 QString name = cfg.readEntry( "Name" );
175 QString icon = cfg.readEntry( "Icon" ); 177 QString icon = cfg.readEntry( "Icon" );
176 if ( !name || !icon ) return; 178 if ( !name || !icon ) return;
177 179
178 QDir subdir = QDir( dir ); 180 QDir subdir = QDir( dir );
179 subdir.cd( file ); 181 subdir.cd( file );
180 subdir.setFilter( QDir::Files ); 182 subdir.setFilter( QDir::Files );