Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83933

wrong location of Trash on Ubuntu

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.15.0 Beta4
    • Fix Version/s: 5.15.1
    • Component/s: Core: I/O
    • Labels:
      None
    • Environment:
      Ubuntu 20.04 64bit
    • Commits:
      112c285fcc065d07734b30ba49a62ead3be3d2c4 (qt/qtbase/dev) 8696a2eb073217516c7c4c22437d2e59868e4440 (qt/qtbase/5.15)

      Description

      Qt 5.15 has a new function

      QFile::moveToTrash()

      This however uses wrong trash location on Ubuntu 20.04.

      #include <QDebug> 
      #include <QFile>
      int main() 
      { 
        QString fileName = "a.txt"; 
        { 
          QFile f(fileName); 
          f.open(QFile::WriteOnly); 
        } 
        { 
          QString trashFileName; 
          QFile::moveToTrash(fileName, &trashFileName); 
          qDebug() << trashFileName; 
        } 
      }
      

       
      This moves the file to trash "/home/vlad/.Trash/files/". However when I use the default file manager in Ubuntu, this file manager uses path "/home/vlad/.local/share/Trash/files/". Which is where users of my application would expect the removed files to be. If there are multiple "correct" locations, it would be nice to be able to decide which one we want to use by Qt API.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            vhilshei Volker Hilsheimer
            Reporter:
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes