void KACLListViewItem::updatePermPixmaps() { unsigned int partialPerms = value; if ( value & ACL_READ ) setPixmap( 2, m_pACLListView->getYesPixmap() ); else if ( partialPerms & ACL_READ ) setPixmap( 2, m_pACLListView->getYesPartialPixmap() ); else setPixmap( 2, TQPixmap() ); if ( value & ACL_WRITE ) setPixmap( 3, m_pACLListView->getYesPixmap() ); else if ( partialPerms & ACL_WRITE ) setPixmap( 3, m_pACLListView->getYesPartialPixmap() ); else setPixmap( 3, TQPixmap() ); if ( value & ACL_EXECUTE ) setPixmap( 4, m_pACLListView->getYesPixmap() ); else if ( partialPerms & ACL_EXECUTE ) setPixmap( 4, m_pACLListView->getYesPartialPixmap() ); else setPixmap( 4, TQPixmap() ); }
void EvaQunMemberPicker::updateBuddyListView() { //if(!mQun) return; lvBuddyList->clear(); TQTextCodec *codec = TQTextCodec::codecForName("GB18030"); std::list<std::string> names = EvaMain::user->getGroupNames(); std::list<std::string>::iterator groupIter; int i=0; for(groupIter = names.begin(); groupIter!= names.end(); ++groupIter){ TQString g = codec->toUnicode(groupIter->c_str()); TQCheckListItem *item = new TQCheckListItem(lvBuddyList, g, TQCheckListItem::CheckBox); item->setState(TQCheckListItem::Off); groups[i++] = item; } //QunInfo info = mQun->getDetails(); std::map<unsigned int, TQQFriend>::iterator iter; std::map<unsigned int, TQQFriend> list = (EvaMain::user->getFriendList()).getAllFriendsMap(); for(iter = list.begin(); iter != list.end(); ++iter){ int id = iter->second.getQQ(); TQString nick = EvaTextFilter::filter(codec->toUnicode(iter->second.getNick().c_str())); int groupIndex = iter->second.getGroupIndex(); TQCheckListItem *group = groups[groupIndex]; if(!group) continue; short faceID = (iter->second.getFace())/3 + 1; if(faceID<1) faceID = 1; TQCheckListItem *item = new TQCheckListItem(group, nick + "(" + TQString::number(id) + ")", TQCheckListItem::CheckBox); TQPixmap *pic = EvaMain::images->getFace(faceID, true); if(pic) { TQImage img(pic->convertToImage().smoothScale(16, 16)); item->setPixmap(0, TQPixmap(img)); }else{ fprintf(stderr, "EvaQunMemberPicker::updateBuddyListView (id:%d, faceID:%d, %s) -- NULL TQPixmap pointer, ignored!\n", id, faceID, nick.ascii()); } if(mQun && mQun->hasMember(id)) item->setState(TQCheckListItem::On); else item->setState(TQCheckListItem::Off); buddyList[id] = item; } }
void EvaSystemTray::setIconTo( TQPixmap * pix ) { if(!pix) return; bool timerRunning = false; if(blinkTimer->isActive()){ blinkTimer->stop(); timerRunning = true; } TQMovie *mov = movie(); if(mov) mov->pause(); TQImage img(pix->convertToImage().smoothScale(16, 16)); TQLabel::setPixmap(TQPixmap(img)); if(timerRunning) blinkTimer->start(300, false); }
TQPixmap KIMProxy::presenceIcon( const TQString& uid ) { AppPresenceCurrent ap; ap.presence = 0; if ( initialize() ) { ContactPresenceListCurrent presence = d->presence_map[ uid ]; ap = presence.best(); } if ( ap.appId.isEmpty() ) { //kdDebug( 790 ) << k_funcinfo << "returning a null TQPixmap because we were asked for an icon for a uid we know nothing about" << endl; return TQPixmap(); } else { //kdDebug( 790 ) << k_funcinfo << "returning this: " << d->presence_icons[ ap.presence ] << endl; return SmallIcon( d->presence_icons[ ap.presence ]); } }
void Systemtray::updateBackgroundPixmap ( const TQPixmap & pixmap) { QXEmbed *emb; setPaletteBackgroundPixmap (pixmap); for (emb = m_Wins.first(); emb != 0L; emb = m_Wins.next()) { //Stupid stupid stupid work around for annoying bug //QXEmbed ignores setBackgroundOrigin(AncestorOrigin).... TQPixmap bug = TQPixmap(emb->size()); bitBlt(TQT_TQPAINTDEVICE(&bug), 0, 0, TQT_TQPAINTDEVICE(const_cast<TQPixmap*>(&pixmap)), emb->parentWidget()->x()+emb->x(), emb->parentWidget()->y()+emb->y(), emb->width(), emb->height(),TQt::CopyROP, false); emb->setPaletteBackgroundPixmap (bug); } TQPoint topPoint = mapToGlobal(TQPoint(0,0)); Window hack = XCreateSimpleWindow(tqt_xdisplay(), winId(), 0,0, width(), height(), 0, 0, 0); XRaiseWindow(tqt_xdisplay(), hack); XMapWindow(tqt_xdisplay(), hack); XUnmapWindow(tqt_xdisplay(), hack); XDestroyWindow(tqt_xdisplay(), hack); }
void EvaSystemTray::slotTimeout() { if(messageStack.isEmpty() || iconStack.isEmpty()){ if(blinkTimer->isActive()) blinkTimer->stop(); messageStack.clear(); iconStack.clear(); setIconTo(statusPix); return; } if(isBlinkOn){ TQLabel::setPixmap(TQPixmap()); isBlinkOn = false; }else{ int id = messageStack.top(); int face = iconStack.top(); if(id == -1 && face == -1){ if(images) setIconTo(images->getIcon("SYSTEM_MSG")); } if(id != -1 && face == -2){ if(images) setIconTo(images->getIcon("TQUN")); } if(id != -1 && face != -1 && face != -2){ if(images){ TQPixmap *pic = images->getUserHeadPixmap(id); if(!pic) pic = images->getFace(images->getFaceFileIndex(face)); setIconTo(pic); } } isBlinkOn = true; } }
void Zone::readZoneList(TDEListView *listView ) { const KTimezones::ZoneMap zones = m_zoneDb.allZones(); TQMap<TQString, TQListViewItem*> KontinentMap; listView->setRootIsDecorated(true); for (KTimezones::ZoneMap::ConstIterator it = zones.begin(); it != zones.end(); ++it) { const KTimezone *zone = it.data(); TQString tzName = zone->name(); TQString comment = zone->comment(); if (!comment.isEmpty()) comment = i18n(comment.utf8()); const TQStringList KontCity = TQStringList::split("/", i18n(tzName.utf8()).replace("_", " ")); TQListViewItem* Kontinent = KontinentMap[KontCity[0]]; if (!Kontinent) { KontinentMap[KontCity[0]] = new TQListViewItem(listView, KontCity[0]); Kontinent = KontinentMap[KontCity[0]]; Kontinent->setExpandable(true); } TQCheckListItem *li = new TQCheckListItem(Kontinent, KontCity[1], TQCheckListItem::CheckBox); li->setText(1, comment); li->setText(2, tzName); /* store complete path in ListView */ if (_remotezonelist.findIndex(tzName) != -1) li->setOn(true); // locate the flag from /l10n/%1/flag.png // if not available select default "C" flag TQString flag = locate( "locale", TQString("l10n/%1/flag.png").arg(zone->countryCode().lower()) ); if (!TQFile::exists(flag)) flag = locate( "locale", "l10n/C/flag.png" ); if (TQFile::exists(flag)) li->setPixmap(0, TQPixmap(flag)); } }
void CustomSmileyManager::slotFaceSelectionChanged( ) { // TQTable::numSelections() doesn't return the correct value // if use select some rows by pressing shift key int numSelections = 0; int first = -1; for(int r = 0; r < tblFaceList->numRows(); r++){ numSelections += ((tblFaceList->isRowSelected(r))?1:0); if( (numSelections == 1) && (first == -1) ){ first = r; } } bool isSingle = (numSelections == 1); btnEdit->setEnabled(isSingle); btnUp->setEnabled(isSingle); btnDown->setEnabled(isSingle); if(numSelections){ TQListViewItem *item = lvGroups->selectedItem(); if(item){ int gId = m_Config->groupIndex( item->text( 0 ) ); if(gId < 0) return; CustomFace face = m_Config->getFace( gId, first); TQString path = EvaMain::user->getSetting()->getCustomSmileyDir() + "/"; if(gId > 0 ) path += (item->text(0) + "/"); TQString ext = face.org().right(3); lblPreview->clear(); if(ext.lower() == "gif"){ lblPreview->setMovie( TQMovie(path + face.org())); } else { TQImage img(path + face.org() ); lblPreview->setPixmap( TQPixmap(img.smoothScale( lblPreview->size(), TQImage::ScaleMin))); } } } }
ActionLBItem( TQListBox *lb=0, const TQPixmap &pm = TQPixmap(), const TQString &text=TQString::null, const TQString &str=TQString::null ) : TQListBoxPixmap( lb, pm, text ), _str(str) {};
TDMSlimShutdown::TDMSlimShutdown( TQWidget *_parent ) : inherited( _parent ) , targetList( 0 ) { setCaption(i18n("Shutdown TDE")); bool doUbuntuLogout = TDEConfigGroup(TDEGlobal::config(), "Shutdown").readBoolEntry("doUbuntuLogout", false); TQFrame* lfrm = new TQFrame( this ); TQHBoxLayout* hbuttonbox; if(doUbuntuLogout) { TQVBoxLayout* vbox = new TQVBoxLayout( this ); if (has_twin) lfrm->setFrameStyle( TQFrame::NoFrame ); else lfrm->setFrameStyle( TQFrame::StyledPanel | TQFrame::Raised ); lfrm->setLineWidth( style().pixelMetric( TQStyle::PM_DefaultFrameWidth, lfrm ) ); // we need to set the minimum size for the logout box, since it // gets too small if there all options are not available lfrm->setMinimumSize(300,120); vbox->addWidget( lfrm ); vbox = new TQVBoxLayout( lfrm, 2 * KDialog::marginHint(), 2 * KDialog::spacingHint() ); // first line of buttons hbuttonbox = new TQHBoxLayout( vbox, 8 * KDialog::spacingHint() ); hbuttonbox->setAlignment( Qt::AlignHCenter ); // Reboot FlatButton* btnReboot = new FlatButton( lfrm ); btnReboot->setTextLabel( i18n("&Restart"), false ); btnReboot->setPixmap( DesktopIcon( "reload") ); int i = btnReboot->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnReboot->setAccel( "ALT+" + btnReboot->textLabel().lower()[i+1] ) ; hbuttonbox->addWidget ( btnReboot); connect(btnReboot, TQT_SIGNAL(clicked()), TQT_SLOT(slotReboot())); // Copied completely from the standard restart/shutdown dialog GSet( 1 ); GSendInt( G_ListBootOpts ); if (GRecvInt() == BO_OK) { targetList = GRecvStrArr( 0 ); /*int def =*/ GRecvInt(); int cur = GRecvInt(); TQPopupMenu *targets = new TQPopupMenu( this ); btnReboot->setPopupDelay(300); // visually add dropdown for (int i = 0; targetList[i]; i++) { TQString t( TQString::fromLocal8Bit( targetList[i] ) ); targets->insertItem( i == cur ? i18n("current option in boot loader", "%1 (current)").arg( t ) : t, i ); } btnReboot->setPopup( targets ); connect( targets, TQT_SIGNAL(activated(int)), TQT_SLOT(slotReboot(int)) ); } GSet( 0 ); // Copied completely from the standard restart/shutdown dialog // Shutdown FlatButton* btnHalt = new FlatButton( lfrm ); btnHalt->setTextLabel( i18n("&Turn Off"), false ); btnHalt->setPixmap( DesktopIcon( "system-log-out") ); i = btnHalt->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnHalt->setAccel( "ALT+" + btnHalt->textLabel().lower()[i+1] ) ; hbuttonbox->addWidget ( btnHalt ); connect(btnHalt, TQT_SIGNAL(clicked()), TQT_SLOT(slotHalt())); // cancel buttonbox TQHBoxLayout* hbuttonbox2 = new TQHBoxLayout( vbox, 8 * KDialog::spacingHint() ); hbuttonbox2->setAlignment( Qt::AlignRight ); // Back to tdm KSMPushButton* btnBack = new KSMPushButton( KStdGuiItem::cancel(), lfrm ); hbuttonbox2->addWidget( btnBack ); connect(btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); } else { TQHBoxLayout *hbox = new TQHBoxLayout( this, KDmh, KDsh ); if (has_twin) lfrm->setFrameStyle( TQFrame::NoFrame ); else lfrm->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); hbox->addWidget( lfrm, AlignCenter ); // we need to set the minimum size for the logout box, since it // gets too small if there all options are not available TQLabel *icon = new TQLabel( lfrm ); icon->setPixmap( TQPixmap( locate( "data", "tdm/pics/shutdown.jpg" ) ) ); TQVBoxLayout *iconlay = new TQVBoxLayout( lfrm ); iconlay->addWidget( icon ); TQVBoxLayout *buttonlay = new TQVBoxLayout( hbox, KDsh ); buttonlay->addStretch( 1 ); KPushButton *btnHalt = new KPushButton( KGuiItem( i18n("&Turn Off Computer"), "system-log-out" ), this ); buttonlay->addWidget( btnHalt ); connect( btnHalt, TQT_SIGNAL(clicked()), TQT_SLOT(slotHalt()) ); buttonlay->addSpacing( KDialog::spacingHint() ); TDMDelayedPushButton *btnReboot = new TDMDelayedPushButton( KGuiItem( i18n("&Restart Computer"), "reload" ), this ); buttonlay->addWidget( btnReboot ); connect( btnReboot, TQT_SIGNAL(clicked()), TQT_SLOT(slotReboot()) ); GSet( 1 ); GSendInt( G_ListBootOpts ); if (GRecvInt() == BO_OK) { targetList = GRecvStrArr( 0 ); /*int def =*/ GRecvInt(); int cur = GRecvInt(); TQPopupMenu *targets = new TQPopupMenu( this ); for (int i = 0; targetList[i]; i++) { TQString t( TQString::fromLocal8Bit( targetList[i] ) ); targets->insertItem( i == cur ? i18n("current option in boot loader", "%1 (current)").arg( t ) : t, i ); } btnReboot->setPopup( targets ); connect( targets, TQT_SIGNAL(activated(int)), TQT_SLOT(slotReboot(int)) ); } GSet( 0 ); buttonlay->addStretch( 1 ); if (_scheduledSd != SHUT_NEVER) { KPushButton *btnSched = new KPushButton( KGuiItem( i18n("&Schedule...") ), this ); buttonlay->addWidget( btnSched ); connect( btnSched, TQT_SIGNAL(clicked()), TQT_SLOT(slotSched()) ); buttonlay->addStretch( 1 ); } buttonlay->addWidget( new KSeparator( this ) ); buttonlay->addSpacing( 0 ); KPushButton *btnBack = new KPushButton( KStdGuiItem::cancel(), this ); buttonlay->addWidget( btnBack ); connect( btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject()) ); buttonlay->addSpacing( KDialog::spacingHint() ); } }
TQString KURIFilterData::iconName() { if( m_bChanged ) { m_customIconPixmap = TQPixmap(); switch ( m_iType ) { case KURIFilterData::LOCAL_FILE: case KURIFilterData::LOCAL_DIR: case KURIFilterData::NET_PROTOCOL: { m_strIconName = KMimeType::iconForURL( m_pURI ); break; } case KURIFilterData::EXECUTABLE: { TQString exeName = m_pURI.url(); exeName = exeName.mid( exeName.findRev( '/' ) + 1 ); // strip path if given KService::Ptr service = KService::serviceByDesktopName( exeName ); #ifndef HAVE_ELFICON // Try to find an icon with the same name as the binary (useful for non-tde apps) // FIXME: We should only do this if the binary is in the system path somewhere, // otherwise TDE could end up showing system icons for user binaries if (service && service->icon() != TQString::fromLatin1( "unknown" )) { m_strIconName = service->icon(); } else if ( !TDEGlobal::iconLoader()->loadIcon( exeName, TDEIcon::NoGroup, 16, TDEIcon::DefaultState, 0, true ).isNull() ) { m_strIconName = exeName; } else { // use default m_strIconName = TQString::fromLatin1("exec"); } #else // HAVE_ELFICON // Try to find an icon with the same name as the binary (useful for non-tde apps) // FIXME: We should only do this if the binary is in the system path somewhere, // otherwise TDE could end up showing system icons for user binaries if (service && service->icon() != TQString::fromLatin1( "unknown" )) { m_strIconName = service->icon(); } else if ( !TDEGlobal::iconLoader()->loadIcon( exeName, TDEIcon::NoGroup, 16, TDEIcon::DefaultState, 0, true ).isNull() ) { m_strIconName = exeName; } else { // use default m_strIconName = TQString::fromLatin1("exec"); } // Try to load from elf file (if supported) // Check for an embedded icon unsigned int icon_size; libr_icon *icon = NULL; libr_file *handle = NULL; libr_access_t access = LIBR_READ; char libr_can_continue = 1; if((handle = libr_open(const_cast<char*>(m_pURI.path().ascii()), access)) == NULL) { kdWarning() << "failed to open file" << m_pURI.path() << endl; libr_can_continue = 0; } if (libr_can_continue == 1) { icon_size = 32; // FIXME: Is this a reasonable size request for all possible usages of kurifilter? icon = libr_icon_geticon_bysize(handle, icon_size); if (libr_can_continue == 1) { // See if the embedded icon name matches any icon file names already on the system // If it does, use the system icon instead of the embedded one int iconresnamefound = 0; iconentry *entry = NULL; iconlist icons; if(!get_iconlist(handle, &icons)) { // Failed to obtain a list of ELF icons kdWarning() << "failed to obtain ELF icon: " << libr_errmsg() << endl; // See if there is a system icon we can use TQString sysIconName = elf_get_resource(handle, ".metadata_sysicon"); if (!sysIconName.isEmpty()) { if (TDEGlobal::iconLoader()->iconPath(sysIconName.ascii(), 0, true) != "") { m_strIconName = sysIconName; } } libr_close(handle); libr_can_continue = 0; } else { while((entry = get_nexticon(&icons, entry)) != NULL) { if(icon == NULL) { // Try loading this icon as fallback icon = libr_icon_geticon_byname(handle, entry->name); } if (TDEGlobal::iconLoader()->iconPath(entry->name, 0, true) != "") { iconresnamefound = 1; m_strIconName = entry->name; break; } } } if (libr_can_continue == 1) { if ((iconresnamefound == 0) && (icon)) { // Extract the embedded icon size_t icon_data_length; char* icondata = libr_icon_malloc(icon, &icon_data_length); m_customIconPixmap.loadFromData(static_cast<uchar*>(static_cast<void*>(icondata)), icon_data_length); // EVIL CAST if (icon_size != 0) { TQImage ip = m_customIconPixmap.convertToImage(); ip = ip.smoothScale(icon_size, icon_size); m_customIconPixmap.convertFromImage(ip); } free(icondata); libr_icon_close(icon); } libr_close(handle); } } } #endif // HAVE_ELFICON break; } case KURIFilterData::HELP: { m_strIconName = TQString::fromLatin1("khelpcenter"); break; } case KURIFilterData::SHELL: { m_strIconName = TQString::fromLatin1("konsole"); break; } case KURIFilterData::ERROR: case KURIFilterData::BLOCKED: { m_strIconName = TQString::fromLatin1("error"); break; } default: m_strIconName = TQString::null; break; } m_bChanged = false; } return m_strIconName; }
TopLevel::TopLevel(TQWidget *parent, const char *name) : TQWidget(parent, name) { setCaption("Item container test application"); TQHBoxLayout* hBox = new TQHBoxLayout( this ); TQVBoxLayout* vBox = new TQVBoxLayout( hBox ); hBox->addSpacing( 5 ); //Selection mode selection m_pbgMode = new TQButtonGroup( 1, Qt::Horizontal, "Selection Mode", this); m_pbgMode->insert(new TQRadioButton("NoSlection", m_pbgMode), TopLevel::NoSelection ); m_pbgMode->insert(new TQRadioButton("Single", m_pbgMode), TopLevel::Single ); m_pbgMode->insert(new TQRadioButton("Multi", m_pbgMode), TopLevel::Multi ); m_pbgMode->insert(new TQRadioButton("Extended", m_pbgMode), TopLevel::Extended ); m_pbgMode->setExclusive( true ); vBox->addWidget( m_pbgMode ); connect( m_pbgMode, TQT_SIGNAL( clicked( int ) ), this, TQT_SLOT( slotSwitchMode( int ) ) ); //Signal labels TQGroupBox* gbWiget = new TQGroupBox( 1, Qt::Horizontal, "Widget", this); m_plblWidget = new TQLabel( gbWiget ); vBox->addWidget( gbWiget ); TQGroupBox* gbSignal = new TQGroupBox( 1, Qt::Horizontal, "emitted Signal", this); m_plblSignal = new TQLabel( gbSignal ); vBox->addWidget( gbSignal ); TQGroupBox* gbItem = new TQGroupBox( 1, Qt::Horizontal, "on Item", this); m_plblItem = new TQLabel( gbItem ); vBox->addWidget( gbItem ); TQButtonGroup* bgListView = new TQButtonGroup( 1, Qt::Horizontal, "TDEListView", this); TQCheckBox* cbListView = new TQCheckBox("Single Column", bgListView); vBox->addWidget( bgListView ); connect( cbListView, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotToggleSingleColumn( bool ) ) ); TDEGlobal::config()->reparseConfiguration(); //Create IconView TQGroupBox* gbIconView = new TQGroupBox( 1, Qt::Horizontal, "TDEIconView", this); m_pIconView = new TDEIconView( gbIconView ); hBox->addWidget( gbIconView ); hBox->addSpacing( 5 ); connect( m_pIconView, TQT_SIGNAL( executed( TQIconViewItem* ) ), this, TQT_SLOT( slotIconViewExec( TQIconViewItem* ) ) ); //Create ListView TQGroupBox* gbListView = new TQGroupBox( 1, Qt::Horizontal, "TDEListView", this); m_pListView = new TDEListView( gbListView ); m_pListView->addColumn("Item"); m_pListView->addColumn("Text"); hBox->addWidget( gbListView ); hBox->addSpacing( 5 ); connect( m_pListView, TQT_SIGNAL( executed( TQListViewItem* ) ), this, TQT_SLOT( slotListViewExec( TQListViewItem* ) ) ); //Create ListBox TQGroupBox* gbListBox = new TQGroupBox( 1, Qt::Horizontal, "TDEListBox", this); m_pListBox = new TDEListBox( gbListBox ); hBox->addWidget( gbListBox ); connect( m_pListBox, TQT_SIGNAL( executed( TQListBoxItem* ) ), this, TQT_SLOT( slotListBoxExec( TQListBoxItem* ) ) ); //Initialize buttons cbListView->setChecked( !m_pListView->allColumnsShowFocus() ); m_pbgMode->setButton( TopLevel::Extended ); slotSwitchMode( TopLevel::Extended ); //Fill container widgets for( int i = 0; i < 10; i++ ) { new TQIconViewItem( m_pIconView, TQString("Item%1").arg(i), TQPixmap(item_xpm) ); TQListViewItem* lv = new TQListViewItem( m_pListView, TQString("Item%1").arg(i), TQString("Text%1").arg(i) ); lv->setPixmap( 0, TQPixmap(item_xpm)); lv->setPixmap( 1, TQPixmap(item_xpm)); new TQListBoxPixmap( m_pListBox, TQPixmap(item_xpm), TQString("Item%1").arg(i)); } connect( m_pIconView, TQT_SIGNAL( clicked( TQIconViewItem* ) ), this, TQT_SLOT( slotClicked( TQIconViewItem* ) ) ); connect( m_pIconView, TQT_SIGNAL( doubleClicked( TQIconViewItem* ) ), this, TQT_SLOT( slotDoubleClicked( TQIconViewItem* ) ) ); }
/* we just simplify the process. if we use KParts::BrowserExtension, we have to do lots extra work, adding so much classes. so just hack like following. grab useful code from TDEHTMLPopupGUIClient(tdehtml_ext.cpp), and change a little bit to fit our needs */ void EvaChatView::slotPopupMenu( const TQString & _url, const TQPoint & point ) { menu->clear(); bool isImage = false; bool hasSelection = TDEHTMLPart::hasSelection(); KURL url = KURL(_url); if(d) delete d; d = new MenuPrivateData; d->m_url = url; DOM::Element e = nodeUnderMouse(); if ( !e.isNull() && (e.elementId() == ID_IMG) ) { DOM::HTMLImageElement ie = static_cast<DOM::HTMLImageElement>(e); TQString src = ie.src().string(); d->m_imageURL = KURL(src); d->m_suggestedFilename = src.right(src.length() - src.findRev("/") -1); isImage=true; } TDEAction *action = 0L; if(hasSelection) { //action = new TDEAction( i18n( "&Copy Text" ), TDEShortcut("Ctrl+C"), this, SLOT( copy() ), // actionCollection(), "copy" ); //action = KStdAction::copy( browserExtension(), SLOT(copy()), actionCollection(), "copy"); //action->setText(i18n("&Copy Text")); //action->setEnabled(true); copyAction->plug(menu); // search text TQString selectedText = TDEHTMLPart::selectedText(); if ( selectedText.length()>18 ) { selectedText.truncate(15); selectedText+="..."; } #ifdef HAS_KONTQUEROR // Fill search provider entries TDEConfig config("kuriikwsfilterrc"); config.setGroup("General"); const TQString defaultEngine = config.readEntry("DefaultSearchEngine", "google"); const char keywordDelimiter = config.readNumEntry("KeywordDelimiter", ':'); // default search provider KService::Ptr service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").arg(defaultEngine)); // search provider icon TQPixmap icon; KURIFilterData data; TQStringList list; const TQString defaultSearchProviderPrefix = *(service->property("Keys").toStringList().begin()) + keywordDelimiter; data.setData( defaultSearchProviderPrefix + TQString("some keyword") ); list << "kurisearchfilter" << "kuriikwsfilter"; TQString name; if ( KURIFilter::self()->filterURI(data, list) ) { TQString iconPath = locate("cache", KMimeType::favIconForURL(data.uri()) + ".png"); if ( iconPath.isEmpty() ) icon = SmallIcon("edit-find"); else icon = TQPixmap( iconPath ); name = service->name(); } else { icon = SmallIcon("google"); name = "Google"; } action = new TDEAction( i18n( "Search '%1' at %2" ).arg( selectedText ).arg( name ), icon, 0, this, SLOT( searchProvider() ), actionCollection(), "searchProvider" ); action->plug(menu); // favorite search providers TQStringList favoriteEngines; favoriteEngines = config.readListEntry("FavoriteSearchEngines"); // for KDE 3.2 API compatibility if(favoriteEngines.isEmpty()) favoriteEngines << "google" << "google_groups" << "google_news" << "webster" << "dmoz" << "wikipedia"; if ( !favoriteEngines.isEmpty()) { TDEActionMenu* providerList = new TDEActionMenu( i18n( "Search '%1' At" ).arg( selectedText ), actionCollection(), "searchProviderList" ); bool hasSubMenus = false; TQStringList::ConstIterator it = favoriteEngines.begin(); for ( ; it != favoriteEngines.end(); ++it ) { if (*it==defaultEngine) continue; service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").arg(*it)); if (!service) continue; const TQString searchProviderPrefix = *(service->property("Keys").toStringList().begin()) + keywordDelimiter; data.setData( searchProviderPrefix + "some keyword" ); if ( KURIFilter::self()->filterURI(data, list) ) { TQString iconPath = locate("cache", KMimeType::favIconForURL(data.uri()) + ".png"); if ( iconPath.isEmpty() ) icon = SmallIcon("edit-find"); else icon = TQPixmap( iconPath ); name = service->name(); providerList->insert( new TDEAction( name, icon, 0, this, SLOT( searchProvider() ), actionCollection(), TQString( "searchProvider" + searchProviderPrefix ).latin1() ) ); hasSubMenus = true; } } if(hasSubMenus) providerList->plug(menu); } #endif // HAS_KONTQUEROR if ( selectedText.contains("://") && KURL(selectedText).isValid() ) { action = new TDEAction( i18n( "Open '%1'" ).arg( selectedText ), "window_new", 0, this, SLOT( openSelection() ), actionCollection(), "openSelection" ); action->plug(menu); } } if ( !url.isEmpty() ) { if (url.protocol() == "mailto") { action = new TDEAction( i18n( "Copy Email Address" ), 0, this, SLOT( slotCopyLinkLocation() ), actionCollection(), "copylinklocation" ); action->plug(menu); } else { action = new TDEAction( i18n( "Copy &Link Address" ), 0, this, SLOT( slotCopyLinkLocation() ), actionCollection(), "copylinklocation" ); action->plug(menu); } } if (isImage) { #ifndef QT_NO_MIMECLIPBOARD action = (new TDEAction( i18n( "Copy Image" ), 0, this, SLOT( slotCopyImage() ), actionCollection(), "copyimage" )); action->plug(menu); #endif action = new TDEAction( i18n( "Save Image As..." ), 0, this, SLOT( slotSaveImageAs() ), actionCollection(), "saveimageas" ); action->plug(menu); action = new TDEAction( i18n( "Save As Custom Smiley"), 0, this, SLOT( slotSaveAsCustomSmiley() ), actionCollection(), "saveascustomsmiley" ); action->plug(menu); } if(menu->count()) menu->popup(point); }
void IconThemesConfig::themeSelected(TQListViewItem *item) { #ifdef HAVE_LIBART KSVGIconEngine engine; #endif TQString dirName(m_themeNames[item->text(0)]); TDEIconTheme icontheme(dirName); if (!icontheme.isValid()) kdDebug() << "notvalid\n"; updateRemoveButton(); const int size = icontheme.defaultSize(TDEIcon::Desktop); TDEIcon icon=icontheme.iconPath("exec.png", size, TDEIcon::MatchBest); if (!icon.isValid()) { #ifdef HAVE_LIBART icon=icontheme.iconPath("exec.svg", size, TDEIcon::MatchBest); if(engine.load(size, size, icon.path)) m_previewExec->setPixmap(*engine.image()); else { icon=icontheme.iconPath("exec.svgz", size, TDEIcon::MatchBest); if(engine.load(size, size, icon.path)) m_previewExec->setPixmap(*engine.image()); } #endif } else m_previewExec->setPixmap(TQPixmap(icon.path)); icon=icontheme.iconPath("folder.png",size,TDEIcon::MatchBest); if (!icon.isValid()) { #ifdef HAVE_LIBART icon=icontheme.iconPath("folder.svg", size, TDEIcon::MatchBest); if(engine.load(size, size, icon.path)) m_previewFolder->setPixmap(*engine.image()); else { icon=icontheme.iconPath("folder.svgz", size, TDEIcon::MatchBest); if(engine.load(size, size, icon.path)) m_previewFolder->setPixmap(*engine.image()); } #endif } else m_previewFolder->setPixmap(TQPixmap(icon.path)); icon=icontheme.iconPath("txt.png",size,TDEIcon::MatchBest); if (!icon.isValid()) { #ifdef HAVE_LIBART icon=icontheme.iconPath("txt.svg", size, TDEIcon::MatchBest); if(engine.load(size, size, icon.path)) m_previewDocument->setPixmap(*engine.image()); else { icon=icontheme.iconPath("txt.svgz", size, TDEIcon::MatchBest); if(engine.load(size, size, icon.path)) m_previewDocument->setPixmap(*engine.image()); } #endif } else m_previewDocument->setPixmap(TQPixmap(icon.path)); emit changed(true); m_bChanged = true; }
TQPixmap KSim::Plugin::icon() const { return d ? d->icon : TQPixmap(); }