|
|
item->insertHeaderWidget(0,headerFileLabel); | item->insertHeaderWidget(0,headerFileLabel); |
connect(headerFileLabel, SIGNAL(leftClickedURL()), SLOT(slotOpen())); | connect(headerFileLabel, SIGNAL(leftClickedURL()), SLOT(slotOpen())); |
} | } |
|
else if (result->tilegroup == BeagleSearch::Ebuilds) { |
|
item->icon->setPixmap(KGlobal::iconLoader()->loadIcon("kuroo", KIcon::NoGroup, KIcon::SizeLarge)); |
|
|
|
KerryLabel *headerFileLabel = new KerryLabel(item); |
|
headerFileLabel->setText(url.fileName()); |
|
headerFileLabel->setTipText(url.prettyURL()); |
|
headerFileLabel->setUseTips(); |
|
headerFileLabel->setURL(*(result->uri)); |
|
item->insertHeaderWidget(0,headerFileLabel); |
|
connect(headerFileLabel, SIGNAL(leftClickedURL()), SLOT(slotOpen())); |
|
|
|
QLabel *headerLabel = new QLabel(item); |
|
headerLabel->setText(i18n(" from ")); |
|
headerLabel->setAlignment(headerLabel->alignment() | Qt::SingleLine); |
|
item->insertHeaderWidget(1,headerLabel); |
|
|
|
QStringList _properties(result->properties); |
|
QString homepage = takeProperty("dc:source",_properties); |
|
if (!homepage.isEmpty()) |
|
{ |
|
KerryLabel *headerFileLabel = new KerryLabel(item); |
|
headerFileLabel->setText(homepage); |
|
headerFileLabel->setAlignment(headerFileLabel->alignment() | Qt::SingleLine); |
|
headerFileLabel->setURL(homepage); |
|
item->insertHeaderWidget(2,headerFileLabel); |
|
connect(headerFileLabel, SIGNAL(leftClickedURL(const QString&)), SLOT(slotOpenURL(const QString&))); |
|
} |
|
|
|
item->setDescriptionText(takeProperty("dc:description", _properties)); |
|
|
|
QString properties; |
|
QString install_time_str = takeProperty("fixme:install_time", _properties); |
|
if (!install_time_str.isEmpty()) |
|
{ |
|
properties=properties+i18n("Installed On: %1").arg(KGlobal::locale()->formatDateTime(datetimeFromString(install_time_str),false))+"<br>"; |
|
} |
|
|
|
QString install_size_str = takeProperty("fixme:contents_byte_count", _properties); |
|
if (!install_size_str.isEmpty()) |
|
{ |
|
properties=properties+i18n("Installed Size: %1").arg(formatBytes(install_size_str))+"<br>"; |
|
} |
|
|
|
QString download_size_str = takeProperty("fixme:download_size", _properties); |
|
if (!download_size_str.isEmpty()) |
|
{ |
|
properties=properties+i18n("Download Size: %1").arg(formatBytes(download_size_str))+"<br>"; |
|
} |
|
|
|
BeagleSearch::PropertyList::iterator it; |
|
for ( it = _properties.begin(); it != _properties.end(); ++it ) |
|
{ |
|
properties=properties+(*it); |
|
} |
|
|
|
if (result->snippet) { |
|
if (!properties.isEmpty()) |
|
properties=properties+"<br>"; |
|
properties=properties+*(result->snippet); |
|
} |
|
|
|
if (!properties.isEmpty()) |
|
item->setPropertiesText("<qt>"+properties+"</qt>"); |
|
|
|
|
|
item->insertHitSpacing(2,10); |
|
buttonGo = new KURLLabel(item); |
|
buttonGo->setPixmap(SmallIcon("kfm")); |
|
item->insertHitWidget(3,buttonGo); |
|
connect(buttonGo, SIGNAL(leftClickedURL()), SLOT(slotOpenDir())); |
|
|
|
buttonGo = new KURLLabel(item); |
|
buttonGo->setText(i18n("Reveal in File Manager")); |
|
item->insertHitWidget(4,buttonGo); |
|
connect(buttonGo, SIGNAL(leftClickedURL()), SLOT(slotOpenDir())); |
|
} |
else { | else { |
KFileItem *fileitem=new KFileItem(*(result->uri),*(result->mime_type),KFileItem::Unknown); | KFileItem *fileitem=new KFileItem(*(result->uri),*(result->mime_type),KFileItem::Unknown); |
item->icon->setPixmap(fileitem->pixmap(KIcon::SizeHuge, KIcon::DefaultState)); | item->icon->setPixmap(fileitem->pixmap(KIcon::SizeHuge, KIcon::DefaultState)); |
|
|
case Website: | case Website: |
show = ( result->tilegroup == BeagleSearch::Website); | show = ( result->tilegroup == BeagleSearch::Website); |
break; | break; |
|
case Ebuilds: |
|
show = ( result->tilegroup == BeagleSearch::Ebuilds); |
|
break; |
default: | default: |
break; | break; |
} | } |
|
|
} | } |
} | } |
| |
|
void SearchDlg::slotOpenURL(const QString& url) |
|
{ |
|
KURL urlObj(url); |
|
//KRun run(urlObj); |
|
//run.setAutoDelete(false); |
|
KRun::runURL(url, "text/html", false, true); |
|
} |
|
|
|
QString SearchDlg::formatBytes(QString& bytesStr) const |
|
{ |
|
static double kilobyte = 1024.0; |
|
static double megabyte = 1024.0*1024.0; |
|
double bytes = KGlobal::locale()->readNumber(bytesStr); |
|
if (bytes < megabyte) |
|
return KGlobal::locale()->formatNumber(bytes/kilobyte, 2) + "K"; |
|
return KGlobal::locale()->formatNumber(bytes/megabyte, 2) + "M"; |
|
} |
|
|
void SearchDlg::slotStartBeagle() | void SearchDlg::slotStartBeagle() |
{ | { |
if (cb_beagleStart->isChecked()) { | if (cb_beagleStart->isChecked()) { |