[PC-BSD Commits] r20912 - in pcbsd/current/src-qt4/EasyPBI: . i18n

svn at pcbsd.org svn at pcbsd.org
Wed Jan 9 10:58:05 PST 2013


Author: kenmoore
Date: 2013-01-09 18:58:05 +0000 (Wed, 09 Jan 2013)
New Revision: 20912

Modified:
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ar.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_de.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_el.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_en_GB.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_en_ZA.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_es.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_et.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_fr.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_fr_CA.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_it.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ja.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ko.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_pl.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_pt_BR.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ru.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_sv.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_tr.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_uk.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_zh_CN.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_zh_HK.qm
   pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_zh_TW.qm
   pcbsd/current/src-qt4/EasyPBI/mainGUI.cpp
   pcbsd/current/src-qt4/EasyPBI/mainGUI.h
   pcbsd/current/src-qt4/EasyPBI/mainGUI.ui
Log:
COmpletely finished with EasyPBI2 now. Just cleaned up the XDG entries tab, so now the MIME stuff is auto-created without all the additional hassle of a seperate tab to manage it. Also finished cleaning up a few graphical annoyances, so it looks nice and polished now.



Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ar.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_de.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_el.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_en_GB.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_en_ZA.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_es.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_et.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_fr.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_fr_CA.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_it.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ja.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ko.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_pl.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_pt_BR.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_ru.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_sv.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_tr.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_uk.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_zh_CN.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_zh_HK.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/i18n/EasyPBI_zh_TW.qm
===================================================================
(Binary files differ)

Modified: pcbsd/current/src-qt4/EasyPBI/mainGUI.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainGUI.cpp	2013-01-09 18:49:57 UTC (rev 20911)
+++ pcbsd/current/src-qt4/EasyPBI/mainGUI.cpp	2013-01-09 18:58:05 UTC (rev 20912)
@@ -59,24 +59,17 @@
 	// -- XDG entries tab --
 	connect(ui->radio_xdg_desktop,SIGNAL(clicked()),this,SLOT(slotXdgTypeChanged()) );
 	connect(ui->radio_xdg_menu,SIGNAL(clicked()),this,SLOT(slotXdgTypeChanged()) );
-	connect(ui->radio_xdg_mime,SIGNAL(clicked()),this,SLOT(slotXdgTypeChanged()) );
 	connect(ui->list_xdg_files,SIGNAL(itemSelectionChanged()), this, SLOT(slotXdgFileChanged()) );
 	ui->push_xdg_refresh->setIcon(Backend::icon("refresh"));
 	connect(ui->push_xdg_refresh, SIGNAL(clicked()), this, SLOT(slotXdgTypeChanged()) );
 	ui->push_xdg_exec->setIcon(Backend::icon("left"));
 	ui->push_xdg_exec->setMenu(&menu_bins);
 	connect(&menu_bins, SIGNAL(triggered(QAction*)), this, SLOT(slotAddBin(QAction*)) );
-
 	ui->push_xdg_savechanges->setIcon(Backend::icon("save"));
-	ui->push_xdg_addmime->setIcon(Backend::icon("left"));
-	ui->push_xdg_addmime->setMenu(&menu_mime);
-	connect(&menu_mime, SIGNAL(triggered(QAction*)), this, SLOT(slotAddMimeType(QAction*)) );
-
 	ui->push_xdg_menu->setIcon(Backend::icon("left"));
 	ui->push_xdg_menu->setMenu(&menu_validMenuCats);
 	connect(&menu_validMenuCats,SIGNAL(triggered(QAction*)),this,SLOT(slotAddMenuCat(QAction*)) );
-
-	ui->push_xdg_clearentry->setIcon(Backend::icon("clear"));
+	ui->push_xdg_clearentry->setIcon(Backend::icon("file"));
 	
 	// -- Scripts tab --
 	ui->push_scripts_save->setIcon(Backend::icon("save"));
@@ -765,10 +758,8 @@
 	ui->label_xdg_menu->setVisible(FALSE); ui->line_xdg_menu->setVisible(FALSE); ui->push_xdg_menu->setVisible(FALSE);
 	ui->check_xdg_nodisplay->setVisible(TRUE);
 	ui->check_xdg_terminal->setVisible(TRUE);
-	ui->push_xdg_addmime->setVisible(TRUE);
 	ui->label_xdg_mimepatterns->setVisible(FALSE); ui->line_xdg_mimepatterns->setVisible(FALSE);
-	ui->label_xdg_mimeinfo->setVisible(FALSE); ui->line_xdg_mimeinfo->setVisible(FALSE);
-
+	
   }else if(ui->radio_xdg_menu->isChecked()){
     //update the files available
     ui->list_xdg_files->clear();
@@ -781,26 +772,8 @@
 	ui->label_xdg_menu->setVisible(TRUE); ui->line_xdg_menu->setVisible(TRUE); ui->push_xdg_menu->setVisible(TRUE);
 	ui->check_xdg_nodisplay->setVisible(TRUE);
 	ui->check_xdg_terminal->setVisible(TRUE);
-	ui->push_xdg_addmime->setVisible(TRUE);
-	ui->label_xdg_mimepatterns->setVisible(FALSE); ui->line_xdg_mimepatterns->setVisible(FALSE);
-	ui->label_xdg_mimeinfo->setVisible(FALSE); ui->line_xdg_mimeinfo->setVisible(FALSE);
-
-  }else if(ui->radio_xdg_mime->isChecked()){
-    //update the files available
-    ui->list_xdg_files->clear();
-    ui->list_xdg_files->addItems(currentModule->filesAvailable("xdg-mime"));	
-    //Set the visibility
-	//Current file
-	ui->label_xdg_name->setVisible(FALSE); ui->line_xdg_name->setVisible(FALSE);
-	ui->label_xdg_exec->setVisible(FALSE); ui->line_xdg_exec->setVisible(FALSE); ui->push_xdg_exec->setVisible(FALSE);
-	ui->label_xdg_icon->setVisible(FALSE); ui->list_xdg_icon->setVisible(FALSE);
-	ui->label_xdg_menu->setVisible(FALSE); ui->line_xdg_menu->setVisible(FALSE); ui->push_xdg_menu->setVisible(FALSE);
-	ui->check_xdg_nodisplay->setVisible(FALSE);
-	ui->check_xdg_terminal->setVisible(FALSE);
-	ui->push_xdg_addmime->setVisible(FALSE);
 	ui->label_xdg_mimepatterns->setVisible(TRUE); ui->line_xdg_mimepatterns->setVisible(TRUE);
-	ui->label_xdg_mimeinfo->setVisible(TRUE); ui->line_xdg_mimeinfo->setVisible(TRUE);
-
+	
   }
   //Select the first file in the list if one is available
   if( ui->list_xdg_files->count() > 0){ ui->list_xdg_files->setCurrentRow(0); }
@@ -817,14 +790,6 @@
       //menu_binsnew.addAction(cBins[i]);
     } 
   }
-  //MIME type pushbuttons
-  menu_mime.clear();
-  QStringList mimetypes = currentModule->currentMimeTypes;
-  if(!mimetypes.isEmpty()){
-    for(int i=0; i<mimetypes.length(); i++){
-      menu_mime.addAction(mimetypes[i]);
-    }
-  }
   //Menu categories
   QString recMenu = currentModule->readValue("portmenucategory");
   QStringList cats = currentModule->validMenuCategories;
@@ -860,11 +825,14 @@
     ui->line_xdg_name->clear();
     ui->line_xdg_exec->clear();
     ui->line_xdg_menu->clear();
-    ui->line_xdg_mimeinfo->clear();
-    ui->line_xdg_mimetype->clear();
     ui->line_xdg_mimepatterns->clear();
     ui->check_xdg_terminal->setChecked(FALSE);
     ui->check_xdg_nodisplay->setChecked(FALSE);
+    ui->push_xdg_savechanges->setEnabled(FALSE);
+    //Make sure we don't have any of the structures loaded from previously
+    currentModule->loadDesktop("");
+    currentModule->loadMenu("");
+    currentModule->loadMime("");
     //Now return
     return; 
   }
@@ -876,7 +844,6 @@
     //update the file info on the GUI
     ui->line_xdg_name->setText( currentModule->readValue("desktopname") );
     ui->line_xdg_exec->setText( currentModule->readValue("desktopexec") ); 
-    ui->line_xdg_mimetype->setText( currentModule->readValue("desktopmimetype") );
     //comboboxes 
     int cicon = icons.indexOf(currentModule->readValue("desktopicon"));
     if( cicon == -1 ){ 
@@ -899,7 +866,6 @@
     //update the file info on the GUI
     ui->line_xdg_name->setText( currentModule->readValue("menuname") );
     ui->line_xdg_exec->setText( currentModule->readValue("menuexec") ); 
-    ui->line_xdg_mimetype->setText( currentModule->readValue("menumimetype") );
     ui->line_xdg_menu->setText( currentModule->readValue("menucategories") );
     //comboboxes
 	  //icons
@@ -917,16 +883,28 @@
     chk = currentModule->readValue("menunodisplay").toLower();
     if( (chk == "true") || (chk=="yes") ){ ui->check_xdg_nodisplay->setChecked(TRUE); }
     else{ ui->check_xdg_nodisplay->setChecked(FALSE); }
-   
-  }else if(ui->radio_xdg_mime->isChecked()){
-    //Load the file
-    currentModule->loadMime(file);
-    //update the file info on the GUI
-    ui->line_xdg_mimetype->setText( currentModule->readValue("mimetype") );
-    ui->line_xdg_mimeinfo->setText( currentModule->readValue("mimeinfo") ); 
-    ui->line_xdg_mimepatterns->setText( currentModule->readValue("mimepatterns") ); 
+    
+    //Load the XDG-MIME file associations
+    QString mime = currentModule->readValue("menumimetype");
+    QStringList mimeavailable = currentModule->filesAvailable("xdg-mime");
+    bool found = FALSE;
+    for( int i=0; i<mimeavailable.length(); i++){
+      currentModule->loadMime(mimeavailable[i]);
+      if(currentModule->readValue("mimetype") == mime){
+        found = TRUE;
+	break;
+      }
+    }
+    //qDebug() << "mimetype detected:" << mime;
+    if(found){
+      ui->line_xdg_mimepatterns->setText( currentModule->readValue("mimepatterns") ); 
+    }else{
+      currentModule->loadMime(""); //Make sure we don't have any mime file loaded
+      ui->line_xdg_mimepatterns->clear();
+    }
+    
   }else{
-	  
+    //do nothing, unknown radio button selected (or none)
   }
 }
 
@@ -945,13 +923,6 @@
   ui->line_xdg_menu->setText(oldcats.join("; "));
 }
 
-
-void MainGUI::slotAddMimeType(QAction* act){
-  //replace the current mime type with the selected one
-  ui->line_xdg_mimetype->setText(act->text() );
-}
-
-
 void MainGUI::slotAddBin(QAction* act){
   //replace the current executable with the new one
   ui->line_xdg_exec->setText(act->text().section("/",-1) );	
@@ -966,8 +937,6 @@
     ok = currentModule->removeDesktop();
   }else if( ui->radio_xdg_menu->isChecked() ){
     ok = currentModule->removeMenu();
-  }else if( ui->radio_xdg_mime->isChecked() ){
-    ok = currentModule->removeMime();
   }
   //Now inform the user if there was an error
   if(!ok){
@@ -986,7 +955,6 @@
     currentModule->writeValue("desktopgenericname",ui->line_xdg_name->text().toLower());
     currentModule->writeValue("desktopexec",ui->line_xdg_exec->text());
     currentModule->writeValue("desktopicon",ui->list_xdg_icon->currentText());
-    currentModule->writeValue("desktopmimetype",ui->line_xdg_mimetype->text());
     QString checked = "false";
     if(ui->check_xdg_terminal->isChecked()){ checked="true"; }
     currentModule->writeValue("desktopterminal",checked);
@@ -1001,7 +969,6 @@
     currentModule->writeValue("menugenericname",ui->line_xdg_name->text().toLower());
     currentModule->writeValue("menuexec",ui->line_xdg_exec->text());
     currentModule->writeValue("menuicon",ui->list_xdg_icon->currentText());
-    currentModule->writeValue("menumimetype",ui->line_xdg_mimetype->text());
     currentModule->writeValue("menucategories", ui->line_xdg_menu->text());
     QString checked = "false";
     if(ui->check_xdg_terminal->isChecked()){ checked="true"; }
@@ -1009,14 +976,10 @@
     checked = "false";
     if(ui->check_xdg_nodisplay->isChecked()){ checked="true"; }
     currentModule->writeValue("menunodisplay",checked);
+    //Setup the mime type associations as appropriate
+    checkMime();
     //Now save the file
     ok = currentModule->writeMenu();    
-  }else if( ui->radio_xdg_mime->isChecked() ){
-    currentModule->writeValue("mimetype",ui->line_xdg_mimetype->text());
-    currentModule->writeValue("mimeinfo",ui->line_xdg_mimeinfo->text());
-    currentModule->writeValue("mimepatterns",ui->line_xdg_mimepatterns->text());
-    //Now save the file
-    ok = currentModule->writeMime();
   }
   //Now inform the user if there was an error
   if(!ok){
@@ -1038,9 +1001,6 @@
   }else if(ui->radio_xdg_menu->isChecked() ){
     filename = ui->line_xdg_exec->text();
     cFiles = currentModule->filesAvailable("xdg-menu").replaceInStrings(".desktop","");
-  }else if(ui->radio_xdg_mime->isChecked() ){
-    filename = ui->line_xdg_mimetype->text().section("/",-1);
-    cFiles = currentModule->filesAvailable("xdg-mime").replaceInStrings(".xml","");
   }
   if(filename.isEmpty()){ return;}
   
@@ -1057,7 +1017,6 @@
     currentModule->writeValue("desktopgenericname",ui->line_xdg_name->text().toLower());
     currentModule->writeValue("desktopexec",ui->line_xdg_exec->text());
     currentModule->writeValue("desktopicon",ui->list_xdg_icon->currentText());
-    currentModule->writeValue("desktopmimetype",ui->line_xdg_mimetype->text());
     QString checked = "false";
     if(ui->check_xdg_terminal->isChecked()){ checked="true"; }
     currentModule->writeValue("desktopterminal",checked);
@@ -1069,11 +1028,13 @@
     
   }else if( ui->radio_xdg_menu->isChecked() ){
     currentModule->loadMenu(filename+".desktop"); //get the new file ready
+    //Update the MIME associations
+    checkMime();
+    //Save the MENU values
     currentModule->writeValue("menuname",ui->line_xdg_name->text());
     currentModule->writeValue("menugenericname",ui->line_xdg_name->text().toLower());
     currentModule->writeValue("menuexec",ui->line_xdg_exec->text());
     currentModule->writeValue("menuicon",ui->list_xdg_icon->currentText());
-    currentModule->writeValue("menumimetype",ui->line_xdg_mimetype->text());
     currentModule->writeValue("menucategories", ui->line_xdg_menu->text());
     QString checked = "false";
     if(ui->check_xdg_terminal->isChecked()){ checked="true"; }
@@ -1083,13 +1044,6 @@
     currentModule->writeValue("menunodisplay",checked);
     //Now save the file
     ok = currentModule->writeMenu();    
-  }else if( ui->radio_xdg_mime->isChecked() ){
-    currentModule->loadMime(filename+".xml"); //get the new file ready
-    currentModule->writeValue("mimetype",ui->line_xdg_mimetype->text());
-    currentModule->writeValue("mimeinfo",ui->line_xdg_mimeinfo->text());
-    currentModule->writeValue("mimepatterns",ui->line_xdg_mimepatterns->text());
-    //Now save the file
-    ok = currentModule->writeMime();
   }
   //Now inform the user if there was an error
   if(!ok){
@@ -1109,6 +1063,44 @@
 	slotXdgFileChanged();
 }
 
+void MainGUI::checkMime(){
+    //This function will check the UI for differences in the MIME patterns
+      // and update/create the MIME file appropriately
+      // The MENU mime type will also be appropriately set
+	
+    QString menumimetype = currentModule->readValue("menumimetype");
+    QString menumimepat = ui->line_xdg_mimepatterns->text();
+    QString cmimetype = currentModule->readValue("mimetype");
+    QString cmimepat = currentModule->readValue("mimepatterns");
+    if( menumimepat != cmimepat ){ //something different about the mime patterns
+	//  ---- Change the MIME file as well ----
+	  //Delete MIME file
+	if(menumimepat.isEmpty()){
+	  currentModule->removeMime();
+	  currentModule->writeValue("menumimetype",""); //set MENU value
+		
+	  //Create new MIME file
+	}else if( cmimetype.isEmpty() || (ui->line_xdg_exec->text() != currentModule->readValue("menuexec")) ){
+	  QString exec = ui->line_xdg_exec->text().simplified();
+	  menumimetype = "application/x-"+exec;
+	  QString newfile = exec+"-xdg.xml";
+	  currentModule->loadMime(newfile); //setup structure
+	  currentModule->writeValue("mimetype",menumimetype); //set mime type
+	  currentModule->writeValue("mimepatterns",menumimepat); //set mime patterns
+	  currentModule->writeMime(); //save the MIME file (using default mime info)
+		
+	  currentModule->writeValue("menumimetype",menumimetype); //set MENU value
+		
+	  //Overwrite existing MIME file
+	}else{
+	  currentModule->writeValue("mimepatterns", menumimepat); //overwrite mime patterns
+	  currentModule->writeMime(); //overwrite the MIME file
+		
+	  currentModule->writeValue("menumimetype",cmimetype); //set MENU value
+	}
+    }
+}
+
 /*------------------------------------------------
    SCRIPTS EDITOR OPTIONS
   -------------------------------------------------

Modified: pcbsd/current/src-qt4/EasyPBI/mainGUI.h
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainGUI.h	2013-01-09 18:49:57 UTC (rev 20911)
+++ pcbsd/current/src-qt4/EasyPBI/mainGUI.h	2013-01-09 18:58:05 UTC (rev 20912)
@@ -67,7 +67,6 @@
     void slotXdgTypeChanged();
     void slotXdgFileChanged();
     void slotAddMenuCat(QAction*);
-    void slotAddMimeType(QAction*);
     void slotAddBin(QAction*);
     void on_push_xdg_remove_clicked();
     void on_push_xdg_savechanges_clicked();
@@ -99,7 +98,7 @@
     Config *settings;
     QLineEdit *line_module;
     QRadioButton *radio_module_port, *radio_module_local;
-    QMenu menu_addOpt, menu_elOpts, menu_validMenuCats, menu_mime, menu_bins, menu_el_bins;
+    QMenu menu_addOpt, menu_elOpts, menu_validMenuCats, menu_bins, menu_el_bins;
 
     QString PBI_BUILDING_NOW;
     bool PBI_BUILD_TERMINATED;
@@ -107,6 +106,7 @@
 
     void SetupDefaults();
     bool isValidPort(QString);
+    void checkMime();
 
 };
 

Modified: pcbsd/current/src-qt4/EasyPBI/mainGUI.ui
===================================================================
(Binary files differ)



More information about the Commits mailing list