Ejemplo n.º 1
0
//================
//    PUBLIC SLOTS
//================
void page_fluxbox_settings::SaveSettings(){
  QStringList FB;
  if(ui->radio_simple->isChecked()){
    FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init");
    // - window placement
    int index = FB.indexOf( FB.filter("session.screen0.windowPlacement:").join("") );
    QString line = "session.screen0.windowPlacement:\t"+ui->combo_session_wloc->itemData( ui->combo_session_wloc->currentIndex() ).toString();
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
    // - window focus
    index = FB.indexOf( FB.filter("session.screen0.focusModel:").join("") );
    line = "session.screen0.focusModel:\t"+ui->combo_session_wfocus->itemData( ui->combo_session_wfocus->currentIndex() ).toString();
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
    // - window theme
    index = FB.indexOf( FB.filter("session.styleFile:").join("") );
    line = "session.styleFile:\t"+ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString();
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
    // - workspace number
    index = FB.indexOf( FB.filter("session.screen0.workspaces:").join("") );
    line = "session.screen0.workspaces:\t"+QString::number(ui->spin_session_wkspaces->value());
    if(index < 0){ FB << line; } //add line to the end of the file
    else{ FB[index] = line; } //replace the current setting with the new one
  }else{
    //advanced editor
    FB = ui->text_file->toPlainText().split("\n");
  }
  //Save the fluxbox settings
  bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init", FB);
  if(!ok){ qDebug() << "Warning: Could not save fluxbox-init"; }
  emit HasPendingChanges(false);
}
Ejemplo n.º 2
0
void page_main::LoadSettings(int){
  emit HasPendingChanges(false);
  emit ChangePageTitle( tr("Desktop Settings") );
  INFO.clear();
  INFO = KnownPages();
  UpdateItems("");
  ui->lineEdit->setFocus();
}
Ejemplo n.º 3
0
//================
//    PUBLIC SLOTS
//================
void page_interface_panels::SaveSettings() {
    QString DPrefix = "desktop-"+QString::number(cscreen)+"/";
    settings->setValue(DPrefix+"panels", PANELS.length());
    for(int i=0; i<PANELS.length(); i++) {
        PANELS[i]->SaveSettings(settings);
    }
    //The plugin ID's will be changed to unique ID's by the desktop - reload in a moment
    emit HasPendingChanges(false);
    settings->sync(); //save to disk right now
    QTimer::singleShot(1000, this, SLOT(LoadSettings()) );
}
Ejemplo n.º 4
0
//================
//    PUBLIC SLOTS
//================
void page_interface_desktop::SaveSettings(){
  QSettings settings("lumina-desktop","desktopsettings");
  QString DPrefix = "desktop-"+QString::number(cscreen)+"/";

  settings.setValue(DPrefix+"generateDesktopIcons", ui->check_desktop_autolaunchers->isChecked() );
  QStringList plugs;
  for(int i=0; i<ui->list_desktop_plugins->count(); i++){
    plugs << ui->list_desktop_plugins->item(i)->whatsThis();
  }
  if(settings.value(DPrefix+"pluginlist",QStringList()).toStringList() != plugs){
    settings.setValue(DPrefix+"pluginlist", plugs);
  }
  //The plugin ID's will be changed to unique ID's by the desktop - reload in a moment
  emit HasPendingChanges(false);
  QTimer::singleShot(1000, this, SLOT(LoadSettings()) );
}
Ejemplo n.º 5
0
//================
//    PUBLIC SLOTS
//================
void page_session_options::SaveSettings(){
  QSettings sessionsettings("lumina-desktop","sessionsettings");
  sessionsettings.setValue("AutomaticDesktopAppLinks",  ui->check_autoapplinks->isChecked());
  sessionsettings.setValue("EnableNumlock", ui->check_session_numlock->isChecked());
  sessionsettings.setValue("PlayStartupAudio", ui->check_session_playloginaudio->isChecked());
  sessionsettings.setValue("PlayLogoutAudio", ui->check_session_playlogoutaudio->isChecked());
  sessionsettings.setValue("TimeFormat", ui->line_session_time->text());
  sessionsettings.setValue("DateFormat", ui->line_session_date->text());
  sessionsettings.setValue("DateTimeOrder", ui->combo_session_datetimeorder->currentData().toString());

  QString lopenWatchFile = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/nowatch";
  if(QFile::exists(lopenWatchFile) && ui->check_watch_app_procs->isChecked()){
    QFile::remove(lopenWatchFile);
  }else if(!QFile::exists(lopenWatchFile) && !ui->check_watch_app_procs->isChecked()){
    QFile file(lopenWatchFile);
    if(file.open(QIODevice::WriteOnly) ){ file.close(); } //just need to touch it to create the file
  }
  emit HasPendingChanges(false);
}
Ejemplo n.º 6
0
void page_interface_desktop::LoadSettings(int screennum){
  if(screennum>=0){
    cscreen = screennum;
  }
  emit HasPendingChanges(false);
  emit ChangePageTitle( tr("Desktop Settings") );
  QSettings settings("lumina-desktop","desktopsettings");
  QString DPrefix = "desktop-"+QString::number(cscreen)+"/";
  ui->check_desktop_autolaunchers->setChecked(settings.value(DPrefix+"generateDesktopIcons",false).toBool() );

  QStringList dplugs = settings.value(DPrefix+"pluginlist",QStringList()).toStringList();
  ui->list_desktop_plugins->clear();
  for(int i=0; i<dplugs.length(); i++){
    QListWidgetItem* it = new QListWidgetItem();
    it->setWhatsThis(dplugs[i]); //save the full thing instantly
    //Now load the rest of the info about the plugin
    QString num;
    if(dplugs[i].contains("---")){ 
      num = dplugs[i].section("---",1,1).section(".",1,1).simplified(); //Skip the screen number
      if(num=="1"){ num.clear(); } //don't bother showing the number
      dplugs[i] = dplugs[i].section("---",0,0);
    }
    if(dplugs[i].startsWith("applauncher::")){
      bool ok = false;
      XDGDesktop app = LXDG::loadDesktopFile(dplugs[i].section("::",1,50), ok);
      if(!ok){ continue; } //invalid for some reason
      //Now fill the item with the necessary info
      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(dplugs[i]);
      if( info.ID.isEmpty() ){ continue; } //invalid plugin for some reason
      it->setText(info.name);
      it->setToolTip(info.description);
      it->setIcon( LXDG::findIcon(info.icon,"") );
    }
    if(!num.isEmpty()){ it->setText( it->text()+" ("+num+")"); } //append the number
    ui->list_desktop_plugins->addItem(it);
  }
}
Ejemplo n.º 7
0
void page_autostart::LoadSettings(int){
  emit HasPendingChanges(false);
  emit ChangePageTitle( tr("Startup Services") );
  //qDebug() << "Load AutoStart Files";
  QList<XDGDesktop*> STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items
  //qDebug() << " - done:" << STARTAPPS.length();
  //qDebug() << "StartApps:";
  ui->list_session_start->clear();
  for(int i=0; i<STARTAPPS.length(); i++){
  //qDebug() << STARTAPPS[i]->filePath +" -> " +STARTAPPS[i]->name << STARTAPPS[i]->isHidden;
    if( !STARTAPPS[i]->isValid() || !QFile::exists(STARTAPPS[i]->filePath) ){ continue; }
    QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i]->icon,"application-x-executable"), STARTAPPS[i]->name );
	it->setWhatsThis(STARTAPPS[i]->filePath); //keep the file location
        it->setToolTip(STARTAPPS[i]->comment);
	if(STARTAPPS[i]->isHidden){ it->setCheckState( Qt::Unchecked); }
	else{it->setCheckState( Qt::Checked); }
	ui->list_session_start->addItem(it);
  }
  //Now cleanup all the STARTAPPS data
  for(int i=STARTAPPS.length()-1; i>=0; i--){ STARTAPPS[i]->deleteLater(); }
}
Ejemplo n.º 8
0
void page_interface_panels::LoadSettings(int screennum) {
    if(screennum>=0) {
        cscreen = screennum;
    }
    loading = true;
    emit HasPendingChanges(false);
    emit ChangePageTitle( tr("Desktop Settings") );
    QString DPrefix = "desktop-"+QString::number(cscreen)+"/";
    int panelnumber = settings->value(DPrefix+"panels",-1).toInt();

//First clean any current panels
    for(int i=0; i<PANELS.length(); i++) {
        delete PANELS.takeAt(i);
        i--;
    }
    //Now create new panels
    if(ui->scroll_panels->widget()->layout()==0) {
        ui->scroll_panels->widget()->setLayout( new QHBoxLayout() );
        ui->scroll_panels->widget()->layout()->setContentsMargins(0,0,0,0);
    }
    ui->scroll_panels->widget()->layout()->setAlignment(Qt::AlignLeft);
    //Clear anything left over in the layout
    for(int i=0; i<ui->scroll_panels->widget()->layout()->count(); i++) {
        delete ui->scroll_panels->widget()->layout()->takeAt(i);
    }
    for(int i=0; i<panelnumber; i++) {
        PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO);
        tmp->LoadSettings(settings, cscreen, i);
        PANELS << tmp;
        connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) );
        connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) );
        ui->scroll_panels->widget()->layout()->addWidget(tmp);
    }
    static_cast<QHBoxLayout*>(ui->scroll_panels->widget()->layout())->addStretch();

    QApplication::processEvents();
    loading = false;
}
Ejemplo n.º 9
0
void page_session_options::LoadSettings(int){
  emit HasPendingChanges(false);
  emit ChangePageTitle( tr("Desktop Settings") );
  loading = true;
  QSettings sessionsettings("lumina-desktop","sessionsettings");
  ui->check_session_numlock->setChecked( sessionsettings.value("EnableNumlock", true).toBool() );
  ui->check_session_playloginaudio->setChecked( sessionsettings.value("PlayStartupAudio",true).toBool() );
  ui->check_session_playlogoutaudio->setChecked( sessionsettings.value("PlayLogoutAudio",true).toBool() );
  ui->check_autoapplinks->setChecked( sessionsettings.value("AutomaticDesktopAppLinks",true).toBool() );
  ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") );
  ui->line_session_time->setText( sessionsettings.value("TimeFormat","").toString() );
  ui->line_session_date->setText( sessionsettings.value("DateFormat","").toString() );
  int index = ui->combo_session_datetimeorder->findData( sessionsettings.value("DateTimeOrder","timeonly").toString() );
  ui->combo_session_datetimeorder->setCurrentIndex(index);

  QString lopenWatchFile = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/nowatch";
  ui->check_watch_app_procs->setChecked( !QFile::exists(lopenWatchFile) );

  sessionLoadTimeSample();
  sessionLoadDateSample();
  QApplication::processEvents(); //throw away any interaction events from loading
  loading = false;
}
Ejemplo n.º 10
0
void page_mouse_trueos::LoadSettings(int){
  emit HasPendingChanges(false);
  emit ChangePageTitle( tr("Mouse Settings") );
}
Ejemplo n.º 11
0
//================
//    PUBLIC SLOTS
//================
void page_mouse_trueos::SaveSettings(){

  emit HasPendingChanges(false);
}
Ejemplo n.º 12
0
void page_defaultapps::LoadSettings(int){
  emit HasPendingChanges(false);
  emit ChangePageTitle( tr("Default Applications") );

//First load the lumina-open specific defaults
    //  - Default File Manager
  QString tmp = LXDG::findDefaultAppForMime("inode/directory"); 
  if(tmp.isEmpty()){ tmp = "lumina-fm"; }
  if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
  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_filemanager->setText(tmp.section("/",-1));
      ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") );
    }else{
      ui->tool_default_filemanager->setText(file.name);
      ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") );
    }
  }else if(tmp.isEmpty()){
    ui->tool_default_filemanager->setText(tr("Click to Set"));
    ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") );
  }else{
    //Might be a binary - just print out the raw "path"
      ui->tool_default_filemanager->setText(tmp.section("/",-1));
      ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") );
  }
  // - Default Terminal
  tmp =LXDG::findDefaultAppForMime("application/terminal"); //sessionsettings->value("default-terminal", "xterm").toString();
  if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
  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","") );
  }
  // - Default Web Browser
  tmp = LXDG::findDefaultAppForMime("x-scheme-handler/http"); //appsettings->value("default/webbrowser", "").toString();
  if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
  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_webbrowser->setText(tmp.section("/",-1));
      ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") );
    }else{
      ui->tool_default_webbrowser->setText(file.name);
      ui->tool_default_webbrowser->setIcon(LXDG::findIcon(file.icon,"") );
    }
  }else if(tmp.isEmpty()){
    ui->tool_default_webbrowser->setText(tr("Click to Set"));
    ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") );
  }else{
    //Might be a binary - just print out the raw "path"
      ui->tool_default_webbrowser->setText(tmp.section("/",-1));
      ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") );
  }
  // - Default Email Client
  tmp = LXDG::findDefaultAppForMime("application/email"); //appsettings->value("default/email", "").toString();
  if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings
  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_email->setText(tmp.section("/",-1));
      ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") );
    }else{
      ui->tool_default_email->setText(file.name);
      ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") );
    }
  }else if(tmp.isEmpty()){
    ui->tool_default_email->setText(tr("Click to Set"));
    ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") );
  }else{
    //Might be a binary - just print out the raw "path"
      ui->tool_default_email->setText(tmp.section("/",-1));
      ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") );
  }
  
  //Now load the XDG mime defaults
  ui->tree_defaults->clear();
  QStringList defMimeList = LXDG::listFileMimeDefaults();
  //qDebug() << "Mime List:\n" << defMimeList.join("\n");
  defMimeList.sort(); //sort by group/mime
  //Now fill the tree by group/mime
  QTreeWidgetItem *group = new QTreeWidgetItem(0); //nothing at the moment
  QString ccat;
  for(int i=0; i<defMimeList.length(); i++){
    //Get the info from this entry
    QString mime = defMimeList[i].section("::::",0,0);
    QString cat = mime.section("/",0,0);
    QString extlist = defMimeList[i].section("::::",1,1);
    QString def = defMimeList[i].section("::::",2,2);
    QString comment = defMimeList[i].section("::::",3,50);
    //Now check if this is a new category
    if(ccat!=cat){
	//New group
	group = new QTreeWidgetItem(0);
	    group->setText(0, cat); //add translations for known/common groups later
	ui->tree_defaults->addTopLevelItem(group);
	ccat = cat;
    }
    //Now create the entry
    QTreeWidgetItem *it = new QTreeWidgetItem();
      it->setWhatsThis(0,mime); // full mimetype
      it->setText(0, QString(tr("%1 (%2)")).arg(mime.section("/",-1), extlist) );
      it->setText(2,comment);
      it->setToolTip(0, comment); it->setToolTip(1,comment);
      //Now load the default (if there is one)
      it->setWhatsThis(1,def); //save for later
      if(def.endsWith(".desktop")){
	bool ok = false;
	XDGDesktop file = LXDG::loadDesktopFile(def, ok);
	if(!ok || file.filePath.isEmpty()){
	  //Might be a binary - just print out the raw "path"
	  it->setText(1,def.section("/",-1));
	  it->setIcon(1, LXDG::findIcon("application-x-executable","") );
	}else{
	  it->setText(1, file.name);
	  it->setIcon(1, LXDG::findIcon(file.icon,"") );
	}     
      }else if(!def.isEmpty()){
	//Binary/Other default
	it->setText(1, def.section("/",-1));
	it->setIcon(1, LXDG::findIcon("application-x-executable","") );
      }
      group->addChild(it);
  }
  
  ui->tree_defaults->sortItems(0,Qt::AscendingOrder);
  
  checkdefaulticons();
}
Ejemplo n.º 13
0
void page_fluxbox_settings::LoadSettings(int){
  emit HasPendingChanges(false);
  emit ChangePageTitle( tr("Window Manager Settings") );
  loading = true;
  if(ui->radio_simple->isChecked()){
    ui->stackedWidget->setCurrentWidget(ui->page_simple); //ensure the proper page is visible
    ui->combo_session_wfocus->clear();
    ui->combo_session_wfocus->addItem( tr("Click To Focus"), "ClickToFocus");
    ui->combo_session_wfocus->addItem( tr("Active Mouse Focus"), "MouseFocus");
    ui->combo_session_wfocus->addItem( tr("Strict Mouse Focus"), "StrictMouseFocus");

    ui->combo_session_wloc->clear();
    ui->combo_session_wloc->addItem( tr("Align in a Row"), "RowSmartPlacement");
    ui->combo_session_wloc->addItem( tr("Align in a Column"), "ColSmartPlacement");
    ui->combo_session_wloc->addItem( tr("Cascade"), "CascadePlacement");
    ui->combo_session_wloc->addItem( tr("Underneath Mouse"), "UnderMousePlacement");

    ui->combo_session_wtheme->clear();
    QStringList dirs; dirs << LOS::AppPrefix()+"share/fluxbox/styles" << QDir::homePath()+"/.fluxbox/styles";
    QFileInfoList fbstyles; 
    for(int i=0; i<dirs.length(); i++){
      QDir fbdir(dirs[i]);
      fbstyles << fbdir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase);
    }
    QString lastdir;
    for(int i=0; i<fbstyles.length(); i++){
      if(lastdir!=fbstyles[i].absolutePath()){
        lastdir = fbstyles[i].absolutePath(); //save for checking later
        if(ui->combo_session_wtheme->count()>0){ ui->combo_session_wtheme->insertSeparator(ui->combo_session_wtheme->count()); }
      }
      ui->combo_session_wtheme->addItem(fbstyles[i].fileName(), fbstyles[i].absoluteFilePath());
    }

    QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init");
    QString val;
    //Do the window placement
    val = FB.filter("session.screen0.windowPlacement:").join("").section(":",1,1).simplified();
    //qDebug() << "Window Placement:" << val;
    int index = ui->combo_session_wloc->findData(val);
    if(index<0){ index = 0;} //use the default
    ui->combo_session_wloc->setCurrentIndex(index);

    //Do the window focus
    val = FB.filter("session.screen0.focusModel:").join("").section(":",1,1).simplified();
    //qDebug() << "Window Focus:" <<  val;
    index = ui->combo_session_wfocus->findData(val);
    if(index<0){ index = 0;} //use the default
    ui->combo_session_wfocus->setCurrentIndex(index);

    //Do the window theme
    val = FB.filter("session.styleFile:").join("").section(":",1,1).simplified();
    //qDebug() << "Window Theme:" << val;
    index = ui->combo_session_wtheme->findData(val);
    if(index<0){ index = 0;} //use the default
    ui->combo_session_wtheme->setCurrentIndex(index);

    //Now the number of workspaces
    val = FB.filter("session.screen0.workspaces:").join("").section(":",1,1).simplified();
    //qDebug() << "Number of Workspaces:" << val;
    if(!val.isEmpty()){ ui->spin_session_wkspaces->setValue(val.toInt()); }
  }else{
    //Advanced editor
    ui->stackedWidget->setCurrentWidget(ui->page_advanced); //ensure the proper page is visible
    ui->text_file->setPlainText( readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init").join("\n") );
  }
  QApplication::processEvents();
  loading = false;
}