Ejemplo n.º 1
0
void MainUI::foundSearchItem(QString path){
   //To get the worker's results
  QListWidgetItem *it = new QListWidgetItem;
    it->setWhatsThis(path);
    it->setToolTip(path);
  //Now setup the visuals
  if(path.simplified().endsWith(".desktop")){
    bool ok = false;
    XDGDesktop desk(path);
    if( !desk.isValid() ){delete it; return; } //invalid file
    it->setText(desk.name);
    it->setIcon( LXDG::findIcon(desk.icon, "application-x-desktop") );
  }else{
    if(QFileInfo(path).isDir()){ 
      it->setIcon( LXDG::findIcon("inode-directory","") );
      it->setText( path.replace(QDir::homePath(), "~") );
    }else{ 
      if(QFileInfo(path).isExecutable()){
	it->setIcon( LXDG::findIcon("application-x-executable","") ); 
      }else{
        it->setIcon( LXDG::findMimeIcon(path.section("/",-1).section(".",-1)) ); 
      }
      it->setText( path.section("/",-1) );
    }
    
  }
  //Now add it to the widget
  ui->listWidget->addItem(it);
  if(ui->listWidget->count()>100){ searcher->StopSearch(); } //just in case
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
// Get screen center
QPoint Utils::Misc::screenCenter(QWidget *win)
{
    int scrn = 0;
    const QWidget *w = win->window();

    if (w)
        scrn = QApplication::desktop()->screenNumber(w);
    else if (QApplication::desktop()->isVirtualDesktop())
        scrn = QApplication::desktop()->screenNumber(QCursor::pos());
    else
        scrn = QApplication::desktop()->screenNumber(win);

    QRect desk(QApplication::desktop()->availableGeometry(scrn));
    return QPoint((desk.width() - win->frameGeometry().width()) / 2, (desk.height() - win->frameGeometry().height()) / 2);
}
Ejemplo n.º 4
0
void CCharTip::reposition()
{
    QRect rect(itsItem);

    rect.moveTopRight(itsParent->mapToGlobal(rect.topRight()));

    QPoint pos(rect.center());
    QRect  desk(KGlobalSettings::desktopGeometry(rect.center()));

    if (rect.center().x() + width() > desk.right())
        if (pos.x() - width() < 0)
            pos.setX(0);
        else
            pos.setX( pos.x() - width() );
    // should the tooltip be shown above or below the ivi ?
    if (rect.bottom() + height() > desk.bottom())
        pos.setY( rect.top() - height() );
    else
        pos.setY(rect.bottom() + 1);

    move(pos);
    update();
}