Пример #1
0
void KfindTabWidget::setURL( const KURL & url )
{
  TDEConfig *conf = TDEGlobal::config();
  conf->setGroup("History");
  m_url = url;
  TQStringList sl = conf->readPathListEntry("Directories");
  dirBox->clear(); // make sure there is no old Stuff in there

  if(!sl.isEmpty()) {
    dirBox->insertStringList(sl);
    // If the _searchPath already exists in the list we do not
    // want to add it again
    int indx = sl.findIndex(m_url.prettyURL());
    if(indx == -1)
      dirBox->insertItem(m_url.prettyURL(), 0); // make it the first one
    else
      dirBox->setCurrentItem(indx);
  }
  else {
    TQDir m_dir("/lib");
    dirBox ->insertItem( m_url.prettyURL() );
    dirBox ->insertItem( "file:" + TQDir::homeDirPath() );
    dirBox ->insertItem( "file:/" );
    dirBox ->insertItem( "file:/usr" );
    if (m_dir.exists())
      dirBox ->insertItem( "file:/lib" );
    dirBox ->insertItem( "file:/home" );
    dirBox ->insertItem( "file:/etc" );
    dirBox ->insertItem( "file:/var" );
    dirBox ->insertItem( "file:/mnt" );
  }
}
Пример #2
0
void KfindTabWidget::setURL( const QUrl & url )
{
  KConfigGroup conf(KSharedConfig::openConfig(), "History");
  m_url = url;
  QStringList sl = conf.readPathEntry("Directories", QStringList());
  dirBox->clear(); // make sure there is no old Stuff in there

  if(!sl.isEmpty()) {
    dirBox->addItems(sl);
    // If the _searchPath already exists in the list we do not
    // want to add it again
    int indx = sl.indexOf(m_url.toDisplayString());
    if(indx == -1) {
      dirBox->insertItem(0, m_url.toDisplayString()); // make it the first one
      dirBox->setCurrentIndex(0);
    }
    else
      dirBox->setCurrentIndex(indx);
  }
  else {
    QDir m_dir(QStringLiteral("/lib"));
    dirBox ->insertItem( 0, m_url.toDisplayString() );
    dirBox ->addItem( QStringLiteral("file:") + QDir::homePath() );
    dirBox ->addItem( QStringLiteral("file:/") );
    dirBox ->addItem( QStringLiteral("file:/usr") );
    if (m_dir.exists())
      dirBox ->addItem( QStringLiteral("file:/lib") );
    dirBox ->addItem( QStringLiteral("file:/home") );
    dirBox ->addItem( QStringLiteral("file:/etc") );
    dirBox ->addItem( QStringLiteral("file:/var") );
    dirBox ->addItem( QStringLiteral("file:/mnt") );
    dirBox->setCurrentIndex(0);
  }
}
Пример #3
0
void KfindTabWidget::loadHistory()
{
  // Load pattern history
  KConfigGroup conf(KSharedConfig::openConfig(), QLatin1String("History"));
  QStringList sl = conf.readEntry(QLatin1String("Patterns"), QStringList());
  if(!sl.isEmpty())
    nameBox->addItems(sl);
  else
    nameBox->addItem(QLatin1String("*"));

  sl = conf.readPathEntry(QLatin1String("Directories"), QStringList());
  if(!sl.isEmpty()) {
    dirBox->addItems(sl);
    // If the _searchPath already exists in the list we do not
    // want to add it again
    int indx = sl.indexOf(m_url.toDisplayString());
    if(indx == -1) {
      dirBox->insertItem(0, m_url.toDisplayString()); // make it the first one
      dirBox->setCurrentIndex(0);
    }
    else
      dirBox->setCurrentIndex(indx);
  }
  else {
    QDir m_dir(QStringLiteral("/lib"));
    dirBox ->insertItem( 0, m_url.toDisplayString() );
    dirBox ->addItem( QStringLiteral("file:") + QDir::homePath() );
    dirBox ->addItem( QStringLiteral("file:/") );
    dirBox ->addItem( QStringLiteral("file:/usr") );
    if (m_dir.exists())
      dirBox ->addItem( QStringLiteral("file:/lib") );
    dirBox ->addItem( QStringLiteral("file:/home") );
    dirBox ->addItem( QStringLiteral("file:/etc") );
    dirBox ->addItem( QStringLiteral("file:/var") );
    dirBox ->addItem( QStringLiteral("file:/mnt") );
    dirBox ->setCurrentIndex(0);
  }
}
Пример #4
0
void KfindTabWidget::loadHistory()
{
  // Load pattern history
  TDEConfig *conf = TDEGlobal::config();
  conf->setGroup("History");
  TQStringList sl = conf->readListEntry("Patterns");
  if(!sl.isEmpty())
    nameBox->insertStringList(sl);
  else
    nameBox->insertItem("*");

  sl = conf->readPathListEntry("Directories");
  if(!sl.isEmpty()) {
    dirBox->insertStringList(sl);
    // If the _searchPath already exists in the list we do not
    // want to add it again
    int indx = sl.findIndex(m_url.prettyURL());
    if(indx == -1)
      dirBox->insertItem(m_url.prettyURL(), 0); // make it the first one
    else
      dirBox->setCurrentItem(indx);
  }
  else {
    TQDir m_dir("/lib");
    dirBox ->insertItem( m_url.prettyURL() );
    dirBox ->insertItem( "file:" + TQDir::homeDirPath() );
    dirBox ->insertItem( "file:/" );
    dirBox ->insertItem( "file:/usr" );
    if (m_dir.exists())
      dirBox ->insertItem( "file:/lib" );
    dirBox ->insertItem( "file:/home" );
    dirBox ->insertItem( "file:/etc" );
    dirBox ->insertItem( "file:/var" );
    dirBox ->insertItem( "file:/mnt" );
  }
}
Пример #5
0
void NewContestDialog::CreateControls()
{
	// Top level sizer for this dialog
	wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);

	// A static box to give a nice outline of the controls
//	wxStaticBox *sBox = new wxStaticBox(this, wxID_ANY, _("Setup new contest"));
//	wxBoxSizer *sBoxSizer = new wxStaticBoxSizer(sBox, wxVERTICAL);
//	topSizer->Add(sBoxSizer, 0, wxALL, 5);

	// DEFS_DIR is defined in ./Makefile.am AM_CPPFLAGS and is comprised
	// of an Autoconf path variable pointing to the configured
	// installation path for .def files
	wxDir m_dir(_(DEFS_DIR));

	if (!m_dir.IsOpened()) {
		wxString msg_text;

		msg_text.Append(_("Unable to open "));
		msg_text.Append(_(DEFS_DIR));
		msg_text.Append(_("\n"));

		wxMessageDialog m_msg(this,
		                      msg_text,
		                      _("Defs dir open error"),
		                      wxOK);
		return;
	}

	// Populate the Choice control with filenames from default installation
	wxArrayString m_files;

	m_dir.GetAllFiles(_(DEFS_DIR), &m_files, _("*.def"), wxDIR_FILES);
	m_files.Sort();

	wxChoice *m_file_choice = new wxChoice(this, wxID_ANY, wxDefaultPosition,
	                                        wxDefaultSize, m_files);
	m_file_choice->SetStringSelection(m_files.Item(0));

	// Instruction text default defs
	wxBoxSizer *fileTextSizer1 = new wxBoxSizer(wxHORIZONTAL);

	fileTextSizer1->Add(new wxStaticText(this, wxID_ANY,
	                   _("Select a default contest definition file:")), 0,
	                   wxALL|wxALIGN_CENTER_VERTICAL,
	                   5);

	// Default contest definition selection
	wxBoxSizer *fileSizer1 = new wxBoxSizer(wxHORIZONTAL);

	fileSizer1->Add(m_file_choice, 0,
	               wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5);

	// Instruction text customized defs
//	wxBoxSizer *fileTextSizer2 = new wxBoxSizer(wxHORIZONTAL);

	// Custom contest definition file selector
//	fileTextSizer2->Add(new wxStaticText(this, wxID_ANY,
//	                   _("Select a customized contest definition file:")), 0,
//	                   wxALL|wxALIGN_CENTER_VERTICAL,
//	                   5);

	// Dialog buttons
	wxBoxSizer *buttonBox = new wxBoxSizer(wxHORIZONTAL);

	wxButton *OK_btn = new wxButton(this, wxID_OK, wxEmptyString);
	wxButton *Cancel_btn = new wxButton(this, wxID_CANCEL, wxEmptyString);

	buttonBox->Add(Cancel_btn, wxALIGN_RIGHT);
	buttonBox->Add(OK_btn, wxALIGN_RIGHT);

	// Final layout
	topSizer->Add(fileTextSizer1, 0, wxGROW|wxALIGN_CENTER, 5);
	topSizer->Add(fileSizer1, 0, wxGROW|wxALIGN_CENTER, 5);
//	topSizer->Add(fileTextSizer2, 0, wxGROW|wxALIGN_CENTER, 5);
	topSizer->Add(buttonBox, 0, wxGROW, 5);

	SetSizer(topSizer);		// use the sizer for layout
	topSizer->Fit(this);		// fit the dialog to the contents
//	topSizer->SetSizeHints(this);	// set hints to honor min size
}