Logo Search packages:      
Sourcecode: icemc version File versions  Download package

void IceMainWidget::newIcon (  )  [slot]

Select a new icon by using a file dialog

Definition at line 399 of file IceMainWidget.cpp.

Referenced by IceMainWidget().

{
  // TODO: implement a subclass of QFileIconProvider for QFileDialog
  ;//qDebug("DEBUG: IceMainWidget::newIcon()");
  QString icon;
  int ok;
  static QString startDir = homeDir;
  QString filterTypes("XPM Icons (*.xpm);;IceWM Menu Icons (*_16x16.xpm);;All Files (*.*)");

  IceIconPreview *p = new IceIconPreview(); 
  QFileDialog *dialog = new QFileDialog(startDir,QString::null,this,"newExec",true);
  dialog->setShowHiddenFiles(true);
  //dialog->addFilter("All Files (*.*)"); // not compatible with qt 2.3
//    dialog->addFilter("XPM Icons (*.xpm)"); // not compatible with qt 2.3
//    dialog->addFilter("IceWM Icons (*_16x16.xpm)"); // not compatible with qt 2.3
  dialog->setFilters(filterTypes);
  dialog->setMode(QFileDialog::ExistingFile);
  dialog->setCaption("Please Select Icon");
  dialog->setContentsPreviewEnabled(true);
  dialog->setContentsPreview(p,p);
  dialog->setPreviewMode(QFileDialog::Contents);
  ok = dialog->exec();

  icon = dialog->selectedFile();
  if ( (!icon.isEmpty()) && (ok) ) {
    if (iconEdit->isEnabled()) {
      icon = icon.replace( QRegExp("_..x..\\.xpm"), "" );
      iconEdit->setText(icon);
    }
    else
      popupMessage("... to err is human ...","Icon Field is not enabled.\n"
               "Please select appropriate Type for Item\n"
               "(e.g. 'prog' instead of 'separator')");
  }
  else {
    // canceled
  }

  startDir = dialog->dirPath(); // for next use  
  delete dialog;
}


Generated by  Doxygen 1.6.0   Back to index