[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeutils/kfloppy
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2004-08-22 18:49:11
Message-ID: 20040822184911.313331773 () office ! kde ! org
[Download RAW message or body]

CVS commit by goutte: 

Allow to use the filesystems whose needed external programs are found
instead of refusing to do anything.
(For closing #71038, KFloppy should tell which programs are missing
but such code could not be backported while this change can be backported.)
CCMAIL:71038@bugs.kde.org
CCMAIL:87638-close@bugs.kde.org


  M +30 -32    floppy.cpp   1.72
  M +0 -2      floppy.h   1.28


--- kdeutils/kfloppy/floppy.cpp  #1.71:1.72
@@ -98,11 +98,25 @@ FloppyData::FloppyData(QWidget * parent,
 
         // If you modify the user visible string, change them also (far) below
+
+        uint numFileSystems = 0;
+
+        if (FATFilesystem::runtimeCheck()) {
         filesystemComboBox->insertItem(i18n("DOS"));
-#ifdef ANY_LINUX
+            ++numFileSystems;
+        }
+#if defined(ANY_LINUX)
+        if (Ext2Filesystem::runtimeCheck()) {
         filesystemComboBox->insertItem(i18n("ext2"));
+            ++numFileSystems;
+        }
+        if (MinixFilesystem::runtimeCheck()) {
         filesystemComboBox->insertItem(i18n("Minix"));
-#endif
-#ifdef ANY_BSD
+            ++numFileSystems;
+        }
+#elif defined(ANY_BSD)
+        if (UFSFilesystem::runtimeCheck()) {
         filesystemComboBox->insertItem(i18n("UFS"));
+            ++numFileSystems;
+        }
 #endif
 
@@ -148,5 +162,5 @@ FloppyData::FloppyData(QWidget * parent,
         lineedit = new QLineEdit( buttongroup, "Lineedit" );
         lineedit->setText(i18n( "KDE Floppy") );
-        lineedit->setMaxLength(11);
+        lineedit->setMaxLength(11); // ### TODO: translators need to need this \
limit!!!  lineedit->setMinimumWidth( lineedit->sizeHint().width() );
         h2->addWidget( lineedit, AlignRight );
@@ -159,4 +173,6 @@ FloppyData::FloppyData(QWidget * parent,
         formatbutton->setText(i18n( "&Format") );
         formatbutton->setAutoRepeat( false );
+        if (!numFileSystems)
+            formatbutton->setDisabled(false); // We have not any helper program for \
creating any file system  \
connect(formatbutton,SIGNAL(clicked()),this,SLOT(format()));  v3->addWidget( \
formatbutton ); @@ -193,5 +209,10 @@ FloppyData::FloppyData(QWidget * parent,
         setWidgets();
 
-        findExecutables();
+    if (!numFileSystems) {
+        // ### TODO: better error message
+        KMessageBox::error(this,
+            i18n("KFloppy cannot find the support programs needed "
+                    "for sensible operation."));
+    }
 
     int maxW = QMAX( deviceComboBox->sizeHint().width(),
@@ -281,27 +302,4 @@ bool FloppyData::setInitialDevice(const 
 }
 
-
-void FloppyData::findExecutables()
-{
-        bool fruitful = true ;
-        fruitful &= FATFilesystem::runtimeCheck();
-#ifdef ANY_BSD
-        fruitful &= UFSFilesystem::runtimeCheck();
-#else
-#ifdef ANY_LINUX
-        fruitful &= Ext2Filesystem::runtimeCheck();
-#else
-        fruitful = false;
-#endif
-#endif
-
-  if (!fruitful) {
-    formatbutton->setEnabled(false);
-    KMessageBox::error(this,
-        i18n("KFloppy cannot find the support programs needed "
-                "for sensible operation."));
-  }
-}
-
 void FloppyData::quit(){
   if (formatActions) formatActions->quit();

--- kdeutils/kfloppy/floppy.h  #1.27:1.28
@@ -56,6 +56,4 @@ public:
     // set default device
     bool setInitialDevice(const QString& dev);
-    // Startup check for nescessary executables
-    void findExecutables();
     // Override closeEvent() in order to properly close
     // the entire application.    


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic