Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating dynamic Network Shortcuts
Forum Updated to NodeBB v4.3 + New Features

Creating dynamic Network Shortcuts

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 644 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    o0TheRat0o
    wrote on 28 Jan 2019, 17:39 last edited by aha_1980
    #1

    Hello,

    we use a DiskStation in Network. If we move some Files or Folders the Windows Shortcuts (.lnk) are getting broken and there is no System-automatic way to correct this.
    Now i want to write a small Programm that set the new link´s if there are some changes in the File-system.

    I think about to stores the Link- and Targetpath in a File and looking for changes with QFileSystemModel (signal: fileRenamed).
    But i can´t find a way to watch out if a file is moved to an other Folder. In the QFileSystemWatcher Class, there is only a way to check out if the File is removed from the current Folder.

    Can someone help me to get this working? Or did someone have an better idea to solve this Problem?

    My brain is broken :D
    Thank you from Germany

    R 1 Reply Last reply 28 Jan 2019, 18:46
    0
    • O o0TheRat0o
      28 Jan 2019, 17:39

      Hello,

      we use a DiskStation in Network. If we move some Files or Folders the Windows Shortcuts (.lnk) are getting broken and there is no System-automatic way to correct this.
      Now i want to write a small Programm that set the new link´s if there are some changes in the File-system.

      I think about to stores the Link- and Targetpath in a File and looking for changes with QFileSystemModel (signal: fileRenamed).
      But i can´t find a way to watch out if a file is moved to an other Folder. In the QFileSystemWatcher Class, there is only a way to check out if the File is removed from the current Folder.

      Can someone help me to get this working? Or did someone have an better idea to solve this Problem?

      My brain is broken :D
      Thank you from Germany

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 28 Jan 2019, 18:46 last edited by
      #2

      @o0TheRat0o
      i believe there is no Qt-way of achieving this. I think you will have to use native API (if ther is any at all).

      But what you can try is to add a QFileSystemWatcher on the root drive? In case the QFileSystemWatcher class triggers changes also for files in sub-folders? I dont know if thats the case.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • O Offline
        O Offline
        o0TheRat0o
        wrote on 28 Jan 2019, 19:03 last edited by
        #3

        @raven-worx
        Yes i have think about that way, too.
        But in this case it has to be a recursively implementing and i am a bit worried about the efficiency. Because it have to work with changes and renaming.
        I already think about to get the Path´s of the open Explorer Windows. But i don´t know how to implement this.
        If i could get this Path´s, i could use it to realetime watching if there some movements between this Folders.

        R 1 Reply Last reply 28 Jan 2019, 19:11
        0
        • O o0TheRat0o
          28 Jan 2019, 19:03

          @raven-worx
          Yes i have think about that way, too.
          But in this case it has to be a recursively implementing and i am a bit worried about the efficiency. Because it have to work with changes and renaming.
          I already think about to get the Path´s of the open Explorer Windows. But i don´t know how to implement this.
          If i could get this Path´s, i could use it to realetime watching if there some movements between this Folders.

          R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 28 Jan 2019, 19:11 last edited by raven-worx
          #4

          @o0TheRat0o said in Creating dynaimc Network Shortcuts:

          I already think about to get the Path´s of the open Explorer Windows. But i don´t know how to implement this.

          files can be moved also wihtout the explorer window

          Anyway, QFileSystemWatcher has only a limited amount of paths to watch (this is OS dependant). So recursing isn't an option anyway. A watched path for each root drive should be enough, in case it works as i said.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • O Offline
            O Offline
            o0TheRat0o
            wrote on 28 Jan 2019, 22:29 last edited by
            #5

            @raven-worx said in Creating dynamic Network Shortcuts:

            files can be moved also wihtout the explorer window

            That´s right, but in most simple File changes, the Explorer is used.

            Anyway, QFileSystemWatcher has only a limited amount of paths to watch (this is OS dependant). So recursing isn't an option anyway. A watched path for each root drive should be enough, in case it works as i said.

            For testing i write the Code below. But it´s only working in the direkt E:/ path. Not in Subfolders. And it seems there is no Way to check Subfolders without ->addPaths() and the risk of limited amount of paths?

                watcher = new QFileSystemWatcher(this);
                watcher->addPath("E:/");
            
                connect( watcher, SIGNAL(directoryChanged(const QString &)), this, SLOT(directoryChanged(const QString &)) );
                connect( watcher, SIGNAL(fileChanged(const QString &)), this, SLOT(fileChanged(const QString &)) );
            

            hm.... there sould be a solution....

            1 Reply Last reply
            0

            1/5

            28 Jan 2019, 17:39

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved