[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-20 10:42:31
Message-ID: 20040820104231.25A75900E () office ! kde ! org
[Download RAW message or body]

CVS commit by goutte: 

- fix ext2 formatting (no device name)
- add Minix formatting (as the filesystem is better for floppies than ext2)
  (#38954)
CCMAIL:38954-close@bugs.kde.org


  M +21 -0     floppy.cpp   1.70
  M +75 -0     format.cpp   1.15
  M +23 -0     format.h   1.8


--- kdeutils/kfloppy/floppy.cpp  #1.69:1.70
@@ -101,4 +101,5 @@ FloppyData::FloppyData(QWidget * parent,
 #ifdef ANY_LINUX
         filesystemComboBox->insertItem(i18n("ext2"));
+        filesystemComboBox->insertItem(i18n("Minix"));
 #endif
 #ifdef ANY_BSD
@@ -447,4 +448,24 @@ void FloppyData::format(){
 #endif
 
+#ifdef ANY_LINUX
+        else if ( filesystemComboBox->currentText() == i18n("Minix") )
+        {
+                MinixFilesystem *f = new MinixFilesystem(this);
+                f->configure(verifylabel->isChecked(),
+                        labellabel->isChecked(),
+                        lineedit->text());
+                if (f)
+                {
+                        connect(f,SIGNAL(status(const QString &,int)),
+                                this,SLOT(formatStatus(const QString &,int)));
+                        connect(f,SIGNAL(done(KFAction *,bool)),
+                                this,SLOT(reset()));
+                        f->configureDevice(drive,blocks);
+                        formatActions->queue(f);
+                }
+        }
+#endif
+
+
 
         formatActions->exec();

--- kdeutils/kfloppy/format.cpp  #1.14:1.15
@@ -707,4 +707,6 @@ void Ext2Filesystem::exec()
         if (doLabel) *p << "-L" << label ;
 
+        *p << deviceName ;
+
         if (!startProcess())
         {
@@ -717,2 +719,75 @@ void Ext2Filesystem::exec()
 
 #endif
+
+#ifdef ANY_LINUX
+/* static */ QString MinixFilesystem::newfs = QString::null ;
+
+MinixFilesystem::MinixFilesystem(QObject *parent) :
+        FloppyAction(parent)
+{
+        DEBUGSETUP;
+        runtimeCheck();
+        theProcessName="mkfs.minix";
+        setName("Minix2Filesystem");
+}
+
+/* static */ bool MinixFilesystem::runtimeCheck()
+{
+        DEBUGSETUP;
+
+        newfs = findExecutable("mkfs.minix");
+
+        return !newfs.isEmpty();
+}
+
+bool MinixFilesystem::configure(bool v,bool l,const QString &lbl)
+{
+        doVerify=v;
+        doLabel=l;
+        if (l)
+        {
+                label=lbl.stripWhiteSpace();
+        }
+        else
+        {
+                label=QString::null;
+        }
+
+        return true;
+}
+
+void MinixFilesystem::exec()
+{
+        DEBUGSETUP;
+
+        if (!deviceInfo || !deviceName)
+        {
+                emit done(this,false);
+                return;
+        }
+
+        if (newfs.isEmpty())
+        {
+                emit status(i18n("Cannot find a program to create Minix filesystems."),-1);
+                emit done(this,false);
+                return;
+        }
+
+        if (theProcess) delete theProcess;
+        KProcess *p = theProcess = new KProcess;
+
+        *p << newfs;
+
+        // Labeling is not possible
+        if (doVerify) *p << "-c" ;
+
+        *p << deviceName ;
+
+        if (!startProcess())
+        {
+                emit status(i18n("Cannot start Minix format program."),-1);
+                emit done(this,false);
+        }
+}
+
+#endif

--- kdeutils/kfloppy/format.h  #1.7:1.8
@@ -41,4 +41,5 @@
 **     FATFilesystem   Creates an msdos (FAT) filesystem
 **     Ext2Filesystem  Creates ext2 filesystems, under Linux.
+**     MinixFilesystem Creates Minix filesystems, under Linux.
 **     UFSFilesystem   Creates UFS filesystem, under BSD.
 **
@@ -346,2 +347,24 @@ QString findExecutable(const QString &);
 
 #endif
+
+#ifdef ANY_LINUX
+class MinixFilesystem : public FloppyAction
+{
+public:
+        MinixFilesystem(QObject *parent = 0L);
+        
+        virtual void exec();
+        
+        static bool runtimeCheck();
+        
+        /* Same args as FATFilesystem. */
+        bool configure(bool verify, bool label, const QString &l);
+        
+protected:
+        static QString newfs;
+        
+        bool doVerify,doLabel;
+        QString label;
+} ;
+#endif
+


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

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