//================= // PRIVATE SLOTS //================= void page_interface_desktop::deskplugadded(){ GetPluginDialog dlg(this); dlg.LoadPlugins("desktop", PINFO); dlg.exec(); if( !dlg.selected ){ return; } //cancelled QString newplug = dlg.plugID; QListWidgetItem *it = new QListWidgetItem(); if(newplug=="applauncher"){ //Prompt for the application to add XDGDesktop app = getSysApp(); if(app.filePath.isEmpty()){ return; } //cancelled newplug.append("::"+app.filePath); //Now fill the item with the necessary info it->setWhatsThis(newplug); it->setText(app.name); it->setIcon(LXDG::findIcon(app.icon,"") ); it->setToolTip(app.comment); }else{ //Load the info for this plugin LPI info = PINFO->desktopPluginInfo(newplug); if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen) it->setWhatsThis(newplug); it->setText(info.name); it->setToolTip(info.description); it->setIcon( LXDG::findIcon(info.icon,"") ); } ui->list_desktop_plugins->addItem(it); ui->list_desktop_plugins->scrollToItem(it); settingChanged(); }
void page_defaultapps::changeDefaultTerminal(){ //Prompt for the new app XDGDesktop desk = getSysApp(true); if(desk.filePath.isEmpty()){ return; }//nothing selected if(desk.filePath=="reset"){ desk.filePath="xterm"; } //save the new app setting and adjust the button appearance LXDG::setDefaultAppForMime("application/terminal",desk.filePath); //sessionsettings->setValue("default-terminal", desk.filePath); QString tmp = desk.filePath; if(tmp.endsWith(".desktop")){ bool ok = false; XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); if(!ok || file.filePath.isEmpty()){ //Might be a binary - just print out the raw "path" ui->tool_default_terminal->setText(tmp.section("/",-1)); ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); }else{ ui->tool_default_terminal->setText(file.name); ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") ); } }else if(tmp.isEmpty()){ ui->tool_default_terminal->setText(tr("Click to Set")); ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") ); }else{ //Might be a binary - just print out the raw "path" ui->tool_default_terminal->setText(tmp.section("/",-1)); ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); } }
void PanelWidget::on_tool_addplugin_clicked(){ GetPluginDialog dlg(mainui); dlg.LoadPlugins("panel", PINFO); dlg.exec(); if(!dlg.selected){ return; } //cancelled QString pan = dlg.plugID; //getNewPanelPlugin(); if(pan == "applauncher"){ //Prompt for the application to add XDGDesktop app =getSysApp(); if(app.filePath.isEmpty()){ return; } //cancelled pan.append("::"+app.filePath); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name); it->setWhatsThis(pan); ui->list_plugins->addItem(it); ui->list_plugins->setCurrentItem(it); ui->list_plugins->scrollToItem(it); }else{ if(pan.isEmpty()){ return; } //nothing selected //Add the new plugin to the list LPI info = PINFO->panelPluginInfo(pan); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name); it->setWhatsThis(info.ID); ui->list_plugins->addItem(it); ui->list_plugins->setCurrentItem(it); ui->list_plugins->scrollToItem(it); } emit PanelChanged(); }
void page_autostart::addsessionstartapp(){ //Prompt for the application to start QString app = getSysApp(false); //no reset if(app.isEmpty()){ return; } //cancelled XDGDesktop desk(app); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name ); it->setWhatsThis(desk.filePath); it->setToolTip(desk.comment); it->setCheckState(Qt::Checked); ui->list_session_start->addItem(it); ui->list_session_start->setCurrentItem(it); settingChanged(); }
void page_defaultapps::setdefaultitem(){ QTreeWidgetItem *it = ui->tree_defaults->currentItem(); if(it==0){ return; } //no item selected QList<QTreeWidgetItem*> list; for(int i=0; i<it->childCount(); i++){ list << it->child(i); } if(list.isEmpty()){ list << it; } //just do the current item //Prompt for which application to use XDGDesktop desk = getSysApp(false); //no "reset" option if(desk.filePath.isEmpty()){ return; }//nothing selected //Now set the items for(int i=0; i<list.length(); i++){ //Set it in the back end LXDG::setDefaultAppForMime(list[i]->whatsThis(0), desk.filePath); //Set it in the UI list[i]->setWhatsThis(1,desk.filePath); //app path list[i]->setIcon(1,LXDG::findIcon(desk.icon,"")); //reset the icon list[i]->setText(1,desk.name); //reset the name } }