Thorbjørn Lindeijer skrev:
ext Eirik Ulvik wrote:
  
Bookmarks in delted files can be quite pesky? I have some bookmarks that 
were set in files that has been deleted. Now when I do ctr+, to move 
through bookmarks I get an error message that the deleted file cannot be 
opened  (obviously). I got the same result when right clicking on the 
bookmarks in the bookmark window. This meant that I was unable to delete 
the outdated bookmarks. The only solution I found was to create a new 
and valid bookmark, right click it in the bookmark window and then 
choose remove all bookmarks.
    

Hmm, I am unable to reproduce this problem. While there is indeed no 
convenient button to delete a bookmark, I was able to right-click the 
bookmark and choose 'Remove Bookmark', also when the bookmark was 
pointing to a deleted file.

  
A way to solve this might be to give the user the possibility to delete 
a bookmark when QtCreator detects that it is unable to open the file 
containing the bookmark.
    

Yeah, that would be nice.

Regards,
Bjørn

  
I tried it again today and I have the same results as before. My system is Win XP SP3. I updated and built creator from git repo this morning.

I have found where the problem is located. The message box i popped up from editormanager.cpp function EditorManager::openEditor at line 1141. I have put in a solution that is located in bookmarkmanager.cpp function  BookmarkManager::gotoBookmark(Bookmark* bookmark) at line 488-493.

The solution is quite simple, but seems to work. It looks like this:

void BookmarkManager::gotoBookmark(Bookmark* bookmark)

{

    if(QFile::exists(bookmark->filePath()))

         TextEditor::BaseTextEditor::openEditorAt(bookmark->filePath(),

                                                                        bookmark->lineNumber());

    else {

        QMessageBox no_file_warning;

        no_file_warning.setWindowTitle(tr("File does not exist"));

        no_file_warning.setText(tr("Bookmark located in file %1 that does not exist.\nDo you wish to delete the bookmark?").arg(bookmark->fileName()));

        no_file_warning.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);

        int ret = no_file_warning.exec();

        if(ret == QMessageBox::Ok)

            this->removeBookmark(bookmark);

    }

}


One thing that is pending now is that the context menu should be cancelled. It will now pop up somewhere, but not really point to anything. I do not know how to do this.

Eirik.
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator

Reply via email to