|
Lines 548-553
Link Here
|
| 548 |
item->insertHeaderWidget(0,headerFileLabel); |
548 |
item->insertHeaderWidget(0,headerFileLabel); |
| 549 |
connect(headerFileLabel, SIGNAL(leftClickedURL()), SLOT(slotOpen())); |
549 |
connect(headerFileLabel, SIGNAL(leftClickedURL()), SLOT(slotOpen())); |
| 550 |
} |
550 |
} |
|
|
551 |
else if (result->tilegroup == BeagleSearch::Ebuilds) { |
| 552 |
item->icon->setPixmap(KGlobal::iconLoader()->loadIcon("kuroo", KIcon::NoGroup, KIcon::SizeLarge)); |
| 553 |
|
| 554 |
KerryLabel *headerFileLabel = new KerryLabel(item); |
| 555 |
headerFileLabel->setText(url.fileName()); |
| 556 |
headerFileLabel->setTipText(url.prettyURL()); |
| 557 |
headerFileLabel->setUseTips(); |
| 558 |
headerFileLabel->setURL(*(result->uri)); |
| 559 |
item->insertHeaderWidget(0,headerFileLabel); |
| 560 |
connect(headerFileLabel, SIGNAL(leftClickedURL()), SLOT(slotOpen())); |
| 561 |
|
| 562 |
QLabel *headerLabel = new QLabel(item); |
| 563 |
headerLabel->setText(i18n(" from ")); |
| 564 |
headerLabel->setAlignment(headerLabel->alignment() | Qt::SingleLine); |
| 565 |
item->insertHeaderWidget(1,headerLabel); |
| 566 |
|
| 567 |
QStringList _properties(result->properties); |
| 568 |
QString homepage = takeProperty("dc:source",_properties); |
| 569 |
if (!homepage.isEmpty()) |
| 570 |
{ |
| 571 |
KerryLabel *headerFileLabel = new KerryLabel(item); |
| 572 |
headerFileLabel->setText(homepage); |
| 573 |
headerFileLabel->setAlignment(headerFileLabel->alignment() | Qt::SingleLine); |
| 574 |
headerFileLabel->setURL(homepage); |
| 575 |
item->insertHeaderWidget(2,headerFileLabel); |
| 576 |
connect(headerFileLabel, SIGNAL(leftClickedURL(const QString&)), SLOT(slotOpenURL(const QString&))); |
| 577 |
} |
| 578 |
|
| 579 |
item->setDescriptionText(takeProperty("dc:description", _properties)); |
| 580 |
|
| 581 |
QString properties; |
| 582 |
QString install_time_str = takeProperty("fixme:install_time", _properties); |
| 583 |
if (!install_time_str.isEmpty()) |
| 584 |
{ |
| 585 |
properties=properties+i18n("Installed On: %1").arg(KGlobal::locale()->formatDateTime(datetimeFromString(install_time_str),false))+"<br>"; |
| 586 |
} |
| 587 |
|
| 588 |
QString install_size_str = takeProperty("fixme:contents_byte_count", _properties); |
| 589 |
if (!install_size_str.isEmpty()) |
| 590 |
{ |
| 591 |
properties=properties+i18n("Installed Size: %1").arg(formatBytes(install_size_str))+"<br>"; |
| 592 |
} |
| 593 |
|
| 594 |
QString download_size_str = takeProperty("fixme:download_size", _properties); |
| 595 |
if (!download_size_str.isEmpty()) |
| 596 |
{ |
| 597 |
properties=properties+i18n("Download Size: %1").arg(formatBytes(download_size_str))+"<br>"; |
| 598 |
} |
| 599 |
|
| 600 |
BeagleSearch::PropertyList::iterator it; |
| 601 |
for ( it = _properties.begin(); it != _properties.end(); ++it ) |
| 602 |
{ |
| 603 |
properties=properties+(*it); |
| 604 |
} |
| 605 |
|
| 606 |
if (result->snippet) { |
| 607 |
if (!properties.isEmpty()) |
| 608 |
properties=properties+"<br>"; |
| 609 |
properties=properties+*(result->snippet); |
| 610 |
} |
| 611 |
|
| 612 |
if (!properties.isEmpty()) |
| 613 |
item->setPropertiesText("<qt>"+properties+"</qt>"); |
| 614 |
|
| 615 |
|
| 616 |
item->insertHitSpacing(2,10); |
| 617 |
buttonGo = new KURLLabel(item); |
| 618 |
buttonGo->setPixmap(SmallIcon("kfm")); |
| 619 |
item->insertHitWidget(3,buttonGo); |
| 620 |
connect(buttonGo, SIGNAL(leftClickedURL()), SLOT(slotOpenDir())); |
| 621 |
|
| 622 |
buttonGo = new KURLLabel(item); |
| 623 |
buttonGo->setText(i18n("Reveal in File Manager")); |
| 624 |
item->insertHitWidget(4,buttonGo); |
| 625 |
connect(buttonGo, SIGNAL(leftClickedURL()), SLOT(slotOpenDir())); |
| 626 |
} |
| 551 |
else { |
627 |
else { |
| 552 |
KFileItem *fileitem=new KFileItem(*(result->uri),*(result->mime_type),KFileItem::Unknown); |
628 |
KFileItem *fileitem=new KFileItem(*(result->uri),*(result->mime_type),KFileItem::Unknown); |
| 553 |
item->icon->setPixmap(fileitem->pixmap(KIcon::SizeHuge, KIcon::DefaultState)); |
629 |
item->icon->setPixmap(fileitem->pixmap(KIcon::SizeHuge, KIcon::DefaultState)); |
|
Lines 669-674
Link Here
|
| 669 |
case Website: |
745 |
case Website: |
| 670 |
show = ( result->tilegroup == BeagleSearch::Website); |
746 |
show = ( result->tilegroup == BeagleSearch::Website); |
| 671 |
break; |
747 |
break; |
|
|
748 |
case Ebuilds: |
| 749 |
show = ( result->tilegroup == BeagleSearch::Ebuilds); |
| 750 |
break; |
| 672 |
default: |
751 |
default: |
| 673 |
break; |
752 |
break; |
| 674 |
} |
753 |
} |
|
Lines 780-785
Link Here
|
| 780 |
} |
859 |
} |
| 781 |
} |
860 |
} |
| 782 |
|
861 |
|
|
|
862 |
void SearchDlg::slotOpenURL(const QString& url) |
| 863 |
{ |
| 864 |
KURL urlObj(url); |
| 865 |
//KRun run(urlObj); |
| 866 |
//run.setAutoDelete(false); |
| 867 |
KRun::runURL(url, "text/html", false, true); |
| 868 |
} |
| 869 |
|
| 870 |
QString SearchDlg::formatBytes(QString& bytesStr) const |
| 871 |
{ |
| 872 |
static double kilobyte = 1024.0; |
| 873 |
static double megabyte = 1024.0*1024.0; |
| 874 |
double bytes = KGlobal::locale()->readNumber(bytesStr); |
| 875 |
if (bytes < megabyte) |
| 876 |
return KGlobal::locale()->formatNumber(bytes/kilobyte, 2) + "K"; |
| 877 |
return KGlobal::locale()->formatNumber(bytes/megabyte, 2) + "M"; |
| 878 |
} |
| 879 |
|
| 783 |
void SearchDlg::slotStartBeagle() |
880 |
void SearchDlg::slotStartBeagle() |
| 784 |
{ |
881 |
{ |
| 785 |
if (cb_beagleStart->isChecked()) { |
882 |
if (cb_beagleStart->isChecked()) { |