Results 1 to 2 of 2

Thread: 7.4.2 - KDE brain damage fixes - ep.2 - file size in Konqueror, say what??

  1. #1
    Member registered user
    Join Date
    Oct 2004
    Posts
    32

    7.4.2 - KDE brain damage fixes - ep.2 - file size in Konqueror, say what??

    This episode will deal with another "IQ enhancing" feature in today's software, namely konqueror's New Age of Dumbness style of displaying file sizes.

    Ever since 2008, I got used with my konqueror showing me file sizes in bytes. That's because I set it up that way, which is because I prefer precision. In all my activity I need exact file sizes so I can have an exact idea where I stand.

    But when I started digging in Knoppix 7.4.2, I was shocked to find a dumb perversion of what I once knew as "konqueror" courtesy of the influence of brain donor users. I've seen a lot of discussions dating a while ago when they were still trying to figure what new inventions they should use for units measuring the size of a file. Boy, it borders the philosophical nightmare! Just reading that could get a sane man in a mental institution!

    Apparently now we have to put up with a lot of users (and sometimes programmers) born yesterday who came up with the idea to follow "standards" invented by some who were also born yesterday.

    You open up your brand new konqueror and good luck trying to find out what the size of a file is: KiKiMiMiBiBi baloney!!!

    Eversince the invention of the modern computers people used base 2 numbers to calculate data sizes. For those born yesterday, just so you don't remain in the dark, there is a very good reason for that. The entire circuitry of computer uses binary logic. The memory of a computer is quite always a power of 2. Why? Simple! The total memory addressable by a computer is 2 to the power of the CPU address bus width. That's why eversince the 70's and even earlier they used a unit called kB (kilobyte) where kilo meant not 1000 but 1024 (2 to the power of 10). And then of course they called 1048576 (2 to the power of 20) a MB (MegaByte) and so on. And the IT world managed perfectly fine ever since, measuring file sizes in Bytes kiloBytes MegaBytes, GigaBytes and so on, where kilo, Mega, Giga had nothing to do with the decimal numbering system.

    Some argued that because harddisk and flash disk manufacturers are using 1M=1000 we should make that the standard. Well news flash for you: THEY ARE DOING THAT BECAUSE THEY WANT MORE MONEY!!! THEY ARE SIMPLY A BUNCH OF CROOKS!!!
    So basically what you are saying is we should legalize theft. Well guess what, some still don't agree to that.

    And just because some born yesterday woke up this morning whining to their mothers that they can't wrap this binary logic around the 23 or less corners of their brains, doesn't mean that the rest of the world should fall on their knees and bow down to their new "revolutionary" BS(c).

    So now, the brand new konqueror doesn't even have the option of letting the user choose whatever unit they want to see their file sizes in. They probably just assume that everyone was born yesterday, like them. (How dumb is that? Well dumber than a cowpie!)

    Instead the user is supposed to put up with some KiKiMiMiBiBi garbage that happens to make some sense for diaper users only.

    Well I wasn't going to put up with this garbage so I took the matter in my own hands. I contacted a developer from KDE asking what file(s) need to be modified in order to change the display, without wasting their time to give me a patch or anything. I got a very straight and precise answer from a very straight and precise professional:

    Code:
    cd kde-baseapps-4.8.4; ack -i formatbytesize
    So here's what I did: I downloaded the following files from snapshot.debian.org:

    Code:
    kde-baseapps_4.8.4-2.debian.tar.gz
    kde-baseapps_4.8.4-2.dsc
    kde-baseapps_4.8.4.orig.tar.xz
    These are the sources for the exact version (4.8.4-2) of konqueror in Knoppix 7.4.2

    Then I ran this command in the same dir where I saved the files:

    Code:
    dpkg-source -x kde-baseapps_4.8.4-2.dsc
    This extracted the sources in a new subdir "kde-baseapps-4.8.4". (took me a while to figure out what the mama they did with the old 4.8.4-2.diff.gz style of storing the patch versions... boy, another New Age Debianish nightmare, whatever!)

    Then I used the piece of info from the developer.

    And right away I found in the "kde-baseapps-4.8.4" source tree in the file "dolphin/src/kitemviews/kfileitemlistwidget.cpp" the place where the file size format is being established: line 255:

    Code:
    text = KGlobal::locale()->formatByteSize(size);
    If we change that with, for instance:

    Code:
    text = i18n("%1 Bytes", QString::number(size));
    then we get a simple file size format like "nnnnnnnnn Bytes"

    Of course you can try and do a little prettyprinting, separating groups of 3 digits, but as far as I'm concerned this was enough.

    So after changing this line, I typed this, in the root of the "kde-baseapps-4.8.4" source tree:

    Code:
    dpkg-source --commit
    so the change I made can be "endorsed" by the debian building system.

    Then I typed:

    Code:
    dpkg-buildpackage -us -uc
    This one took a while to execute and unfortunately ended up with an error, but fortunately the error was not during the compilation but during the actual deb packaging process. This was the error:

    Code:
    make[2]: Leaving directory `/home/knoppix/Downloads/kde-baseapps-4.8.4/obj-i586-linux-gnu'
    dh_install
    cp: cannot stat `debian/tmp/usr/lib/libdolphinprivate.so.4.8.0': No such file or directory
    dh_install: cp -a debian/tmp/usr/lib/libdolphinprivate.so.4.8.0 debian/dolphin//usr/lib/ returned exit code 1
    make[1]: *** [pre_install_dh_install] Error 2
    make[1]: Leaving directory `/home/knoppix/Downloads/kde-baseapps-4.8.4'
    make: *** [debian/dhmk_install] Error 2
    dpkg-buildpackage: error: debian/rules binary gave error exit status 2
    But even so, we can still accomplish our target. Just copy the following 3 files:

    Code:
    libdolphinprivate.so
    libdolphinprivate.so.4
    libdolphinprivate.so.4.13.3
    from "debian/tmp/usr/lib/" in the "kde-baseapps-4.8.4" source tree to "/usr/lib/" in the system tree, overwriting the existing file there (libdolphinprivate.so, libdolphinprivate.so.4).

    And once I did this, konqueror showed me again the exact file sizes. See the attachment of this message.
    Attached Images Attached Images

  2. #2
    Member registered user
    Join Date
    Oct 2004
    Posts
    32
    In the meantime I noticed the patch I posted doesn't take care of the status bar info.
    So I'm attaching here a revised patch that does that too.
    Also, here's a script that takes care of everything.
    Just execute this script in an empty dir with the patch saved beside it (and don't forget about "apt-get update" first).

    For those who got here googling around: this patch provides (enforces) the display of all file sizes in bytes (only) in konqueror and dolphin 4.8.4-2.
    It is applicable to kde-baseapps_4.8.4-2.debian.tar.gz from Debian. It is intended only for those who happen to prefer it this way.

    Code:
    #!/bin/sh
    
    #### RUN THIS SCRIPT AS ROOT ####
    
    # dolphin/src/kitemviews/kfileitemlistwidget.cpp    # this only takes care of the file list
    #-255:            text = KGlobal::locale()->formatByteSize(size);
    #+255:          text = i18n("%1 Bytes", QString::number(size) );
    
    # dolphin/src/views/dolphinview.cpp                 # this takes care of the status bar too
    #-536          KGlobal::locale()->formatByteSize(totalFileSize));
    #+536          i18n("%1 Bytes", QString::number(totalFileSize)));
    #-540          KGlobal::locale()->formatByteSize(totalFileSize));
    #+540          i18n("%1 Bytes", QString::number(totalFileSize)));
    
    mkdir deb
    cd deb
    wget http://snapshot.debian.org/archive/debian/20140906T041608Z/pool/main/e/exiv2/libexiv2-13_0.24-4_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140906T162502Z/pool/main/s/strigi/libstreamanalyzer0_0.7.8-1.2+b2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140906T162502Z/pool/main/s/strigi/libstreamanalyzer-dev_0.7.8-1.2+b2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140906T162502Z/pool/main/s/strigi/libstreams0_0.7.8-1.2+b2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140906T162502Z/pool/main/s/strigi/libstreams-dev_0.7.8-1.2+b2_i386.deb
    cd ..
    mkdir kdelibs-deps
    cd kdelibs-deps
    wget http://snapshot.debian.org/archive/debian/20140725T162421Z/pool/main/k/kde4libs/kdelibs5-dev_4.13.3-2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140725T162421Z/pool/main/k/kde4libs/libkimproxy4_4.13.3-2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140725T162421Z/pool/main/k/kde4libs/libkutils4_4.13.3-2_i386.deb
    wget http://snapshot.debian.org/archive/debian/20140706T163150Z/pool/main/s/soprano/libsoprano-dev_2.9.4+dfsg-1.1_i386.deb
    cd ..
    
    wget http://snapshot.debian.org/archive/debian/20121020T032134Z/pool/main/k/kde-baseapps/kde-baseapps_4.8.4-2.debian.tar.gz
    wget http://snapshot.debian.org/archive/debian/20121020T032134Z/pool/main/k/kde-baseapps/kde-baseapps_4.8.4-2.dsc
    wget http://snapshot.debian.org/archive/debian/20120609T214937Z/pool/main/k/kde-baseapps/kde-baseapps_4.8.4.orig.tar.xz
    
    echo -e "\n\n-------- installing kde-sc-dev-latest -----------------\n"
    apt-get -y install kde-sc-dev-latest         # kde-sc-dev-latest_4%3a4.8.4+5.77+deb7u1_all.deb
    echo -e "\n\n-------- installing libdlrestrictions-dev -------------\n"
    apt-get -y install libdlrestrictions-dev     # libdlrestrictions-dev_0.15.3_i386.deb
    echo -e "\n\n-------- installing libphonon-dev ---------------------\n"
    apt-get -y install libphonon-dev             # libphonon-dev_4%3a4.6.0.0-3_i386.deb
    echo -e "\n\n-------- installing libqimageblitz-dev ----------------\n"
    apt-get -y install libqimageblitz-dev        # libqimageblitz-dev_1%3a0.0.6-4_i386.deb
    echo -e "\n\n-------- installing libxkbfile-dev --------------------\n"
    apt-get -y install libxkbfile-dev            # libxkbfile-dev_1%3a1.0.8-1_i386.deb
    echo -e "\n\n-------- installing libstreams0 -----------------------\n"
    dpkg -i deb/libstreams0_0.7.8-1.2+b2_i386.deb
    echo -e "\n\n-------- installing libexiv2-13 -----------------------\n"
    dpkg -i deb/libexiv2-13_0.24-4_i386.deb
    echo -e "\n\n-------- installing libstreamanalyzer0 ----------------\n"
    dpkg -i deb/libstreamanalyzer0_0.7.8-1.2+b2_i386.deb
    echo -e "\n\n-------- installing libstreams-dev --------------------\n"
    dpkg -i deb/libstreams-dev_0.7.8-1.2+b2_i386.deb
    echo -e "\n\n-------- installing libstreamanalyzer-dev -------------\n"
    dpkg -i deb/libstreamanalyzer-dev_0.7.8-1.2+b2_i386.deb
    echo -e "\n\n-------- installing shared-desktop-ontologies ---------\n"
    apt-get -y install shared-desktop-ontologies    # shared-desktop-ontologies_0.10.0-1_all.deb
    echo -e "\n\n-------- installing libtidy-dev -----------------------\n"
    apt-get -y install libtidy-dev                  # libtidy-dev_20091223cvs-1.2_i386.deb
    echo -e "\n\n-------- installing libsoprano-dev --------------------\n"
    dpkg -i kdelibs-deps/libsoprano-dev_2.9.4+dfsg-1.1_i386.deb
    echo -e "\n\n-------- installing libkimproxy4 ----------------------\n"
    dpkg -i kdelibs-deps/libkimproxy4_4.13.3-2_i386.deb
    echo -e "\n\n-------- installing libkutils4 ------------------------\n"
    dpkg -i kdelibs-deps/libkutils4_4.13.3-2_i386.deb
    echo -e "\n\n-------- installing kdelibs5-dev ----------------------\n"
    dpkg -i kdelibs-deps/kdelibs5-dev_4.13.3-2_i386.deb
    
    echo -e "\n\n-------- extracting kde-baseapps_4.8.4-2 sources ---------\n"
    dpkg-source -x kde-baseapps_4.8.4-2.dsc
    
    # modify dolphin/src/kitemviews/kfileitemlistwidget.cpp as described above
    echo -e "\n\n-------- applying patch ---------\n"
    cd kde-baseapps-4.8.4
    #patch -p1 < ../konqueror_display_file_sizes_in_bytes.patch                  # this doesn't take care of the status bar message though
    patch -p1 < ../konqueror_display_file_sizes_in_bytes_incl_statusbar.patch    # this does !
    echo -e "\n\n-------- committing changes ---------\n"
    dpkg-source --commit
    echo -e "\n\n-------- rebuilding kde-baseapps_4.8.4-2 debian packages ---------\n"
    dpkg-buildpackage -us -uc             # this fails at the end like this:
    
    # make[2]: Leaving directory `/home/knoppix/Downloads/kde-baseapps-4.8.4/obj-i586-linux-gnu'
    # dh_install
    # cp: cannot stat `debian/tmp/usr/lib/libdolphinprivate.so.4.8.0': No such file or directory
    # dh_install: cp -a debian/tmp/usr/lib/libdolphinprivate.so.4.8.0 debian/dolphin//usr/lib/ returned exit code 1
    # make[1]: *** [pre_install_dh_install] Error 2
    # make[1]: Leaving directory `/home/knoppix/Downloads/kde-baseapps-4.8.4'
    # make: *** [debian/dhmk_install] Error 2
    # dpkg-buildpackage: error: debian/rules binary gave error exit status 2
    
    # but we can still accomplish the target (display file sizes in bytes) by copying
    # libdolphinprivate.so, libdolphinprivate.so.4 and libdolphinprivate.so.4.13.3 to /usr/lib/
    # (overwriting existing libdolphinprivate.so, libdolphinprivate.so.4)
    
    # all konqueror instances must be closed before this
    cp -fpv debian/tmp/usr/lib/libdolphinprivate.so.* /usr/lib/
    
    exit 0
    
    # Now open a konqueror window and check out the results
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by chris_Xnest; 01-04-2015 at 03:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •