summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/packagelistitem.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/packagelistitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 1610a37..1b4812d 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -118,123 +118,123 @@ void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
118 118
119void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, 119void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg,
120 const QRect & r ) 120 const QRect & r )
121{ 121{
122 // Skip QCheckListItem 122 // Skip QCheckListItem
123 // (makes you wonder what we're getting from QCheckListItem) 123 // (makes you wonder what we're getting from QCheckListItem)
124 QListViewItem::paintFocus(p,cg,r); 124 QListViewItem::paintFocus(p,cg,r);
125} 125}
126 126
127QPixmap PackageListItem::statePixmap() const 127QPixmap PackageListItem::statePixmap() const
128{ 128{
129 bool installed = package->installed(); 129 bool installed = package->installed();
130 bool old = package->isOld(); 130 bool old = package->isOld();
131 bool verinstalled = package->otherInstalled(); 131 bool verinstalled = package->otherInstalled();
132 if ( !package->toProcess() ) { 132 if ( !package->toProcess() ) {
133 if ( !installed ) 133 if ( !installed )
134 if (old) 134 if (old)
135 { 135 {
136 if (verinstalled) return *pm_uninstalled_old_installed_new; 136 if (verinstalled) return *pm_uninstalled_old_installed_new;
137 else return *pm_uninstalled_old; 137 else return *pm_uninstalled_old;
138 } 138 }
139 else 139 else
140 { 140 {
141 if (verinstalled) return *pm_uninstalled_installed_old; 141 if (verinstalled) return *pm_uninstalled_installed_old;
142 else return *pm_uninstalled; 142 else return *pm_uninstalled;
143 } 143 }
144 else 144 else
145 if (old) return *pm_installed_old; 145 if (old) return *pm_installed_old;
146 else return *pm_installed; 146 else return *pm_installed;
147 } else { //toProcess() == true 147 } else { //toProcess() == true
148 if ( !installed ) 148 if ( !installed )
149 return *pm_install; 149 return *pm_install;
150 else 150 else
151 return *pm_uninstall; 151 return *pm_uninstall;
152 } 152 }
153} 153}
154 154
155QString PackageListItem::key( int column, bool ascending ) const 155QString PackageListItem::key( int column, bool ascending ) const
156{ 156{
157 if ( column == 2 ) { 157 if ( column == 2 ) {
158 QString t = text(2); 158 QString t = text(2);
159 double bytes=t.toDouble(); 159 double bytes=t.toDouble();
160 if ( t.contains('M') ) bytes*=1024*1024; 160 if ( t.contains('M') ) bytes*=1024*1024;
161 else if ( t.contains('K') || t.contains('k') ) bytes*=1024; 161 else if ( t.contains('K') || t.contains('k') ) bytes*=1024;
162 if ( !ascending ) bytes=999999999-bytes; 162 if ( !ascending ) bytes=999999999-bytes;
163 return QString().sprintf("%09d",(int)bytes); 163 return QString().sprintf("%09d",(int)bytes);
164 } else { 164 } else {
165 return QListViewItem::key(column,ascending); 165 return QListViewItem::key(column,ascending);
166 } 166 }
167} 167}
168 168
169void PackageListItem::setOn( bool b ) 169void PackageListItem::setOn( bool b )
170{ 170{
171 QCheckListItem::setOn( b ); 171 QCheckListItem::setOn( b );
172 package->toggleProcess(); 172 package->toggleProcess();
173 package->setLink( settings->createLinks() ); 173 package->setLink( settings->createLinks() );
174 displayDetails(); 174 displayDetails();
175} 175}
176 176
177void PackageListItem::displayDetails() 177void PackageListItem::displayDetails()
178{ 178{
179 QString sod; 179 QString sod;
180 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); 180 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits());
181 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); 181 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest());
182 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); 182 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
183 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); 183 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")");
184 setText(0, package->name()+sod ); 184 setText(0, package->name()+sod );
185 nameItem->setText( 0, QObject::tr("Name: ")+package->name()); 185 nameItem->setText( 0, QObject::tr("Name: ")+package->name());
186 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); 186 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No")));
187 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); 187 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
188 statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); 188 statusItem->setText( 0, QObject::tr("Status: ")+package->status() );
189 repaint(); 189 repaint();
190} 190}
191 191
192QPopupMenu* PackageListItem::getPopupMenu() 192QPopupMenu* PackageListItem::getPopupMenu()
193{ 193{
194 popupMenu->clear(); 194 popupMenu->clear();
195 destsMenu->clear(); 195 destsMenu->clear();
196 196
197 QAction *popupAction; 197 QAction *popupAction;
198 qDebug("PackageListItem::showPopup "); 198 qDebug("PackageListItem::showPopup ");
199 199
200 if (!package->installed()){ 200 if (!package->installed()){
201 popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); 201 popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
202 QStringList dests = settings->getDestinationNames(); 202 QStringList dests = settings->getDestinationNames();
203 QString ad = settings->getDestinationName(); 203 QString ad = settings->getDestinationName();
204 for (uint i = 0; i < dests.count(); i++ ) 204 for (uint i = 0; i < dests.count(); i++ )
205 { 205 {
206 popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 ); 206 popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 );
207 popupAction->addTo( destsMenu ); 207 popupAction->addTo( destsMenu );
208 if ( dests[i] == ad && getPackage()->toInstall() ) 208 if ( dests[i] == ad && getPackage()->toInstall() )
209 { 209 {
210 popupAction->setToggleAction( true ); 210 popupAction->setToggleAction( true );
211 popupAction->setOn(true); 211 popupAction->setOn(true);
212 } 212 }
213 } 213 }
214 connect( destsMenu, SIGNAL( activated( int ) ), 214 connect( destsMenu, SIGNAL( activated(int) ),
215 this, SLOT( menuAction( int ) ) ); 215 this, SLOT( menuAction(int) ) );
216 popupMenu->popup( QCursor::pos() ); 216 popupMenu->popup( QCursor::pos() );
217 }else{ 217 }else{
218 popupMenu->insertItem( QObject::tr("Remove")); 218 popupMenu->insertItem( QObject::tr("Remove"));
219 connect( popupMenu, SIGNAL( activated( int ) ), 219 connect( popupMenu, SIGNAL( activated(int) ),
220 this, SLOT( menuAction( int ) ) ); 220 this, SLOT( menuAction(int) ) );
221 popupMenu->popup( QCursor::pos() ); 221 popupMenu->popup( QCursor::pos() );
222 } 222 }
223 return popupMenu; 223 return popupMenu;
224} 224}
225 225
226void PackageListItem::menuAction( int i ) 226void PackageListItem::menuAction( int i )
227{ 227{
228 if (!package->installed()){ 228 if (!package->installed()){
229 package->setDest( destsMenu->text(i) ); 229 package->setDest( destsMenu->text(i) );
230 package->setLink( settings->createLinks() ); 230 package->setLink( settings->createLinks() );
231 } 231 }
232 package->setOn(); 232 package->setOn();
233 displayDetails(); 233 displayDetails();
234} 234}
235 235
236//void PackageListItem::toggleProcess() 236//void PackageListItem::toggleProcess()
237//{ 237//{
238// package->toggleProcess() ; 238// package->toggleProcess() ;
239// displayDetails(); 239// displayDetails();
240//} 240//}