KParts::ReadWritePart::closeURL ()

Christoph Cullmann crossfire at babylon2k.de
Fri May 24 21:37:18 BST 2002


On Friday 24 May 2002 22:27, David Faure wrote:
> On Friday 24 May 2002 21:44, Christoph Cullmann wrote:
> > Hi,
> > just noticed that the closeURL methode in kparts wasn't used right in
> > kate, will change that, but have a question:
> > Should the default implementation in kdelibs not check if a file may be
> > overwritten ? That would make the default implementation a lot more
> > useful than atm.
>
> In saveAs() you mean?
Yes, meaned that, is called by closeURL() for example ;)

> Good idea.
>
> KOffice does it before hand, in KoMainWindow, with code like:
>
>         bool bOk;
>         do {
>             bOk = true;
>             ... create KFileDialog ...
>             if(dialog->exec()==QDialog::Accepted)
>                 newURL=dialog->selectedURL();
>             else
>             {
>                 bOk = false;
>                 break;
>             }
>
>             if ( newURL.isEmpty() )
>             {
>                 bOk = false;
>                 break;
>             }
>
>             if ( KIO::NetAccess::exists( newURL ) ) { // this file exists
> => ask for confirmation bOk = KMessageBox::questionYesNo( this,
>                                                   i18n("A document with
> this name already exists.\n"\ "Do you want to overwrite it?"),
> i18n("Warning") ) == KMessageBox::Yes; }
>         } while ( !bOk );
>
> (and then saving if bOk)
>
> The point is to keep asking, if the user selects a file that already
> exists, so that he can choose another file.
Would be nice to get this behaviour in the kpart lib, too ;)

cu
Christoph

-- 
Christoph "Crossfire" Cullmann
Kate/KDE developer
cullmann at kde.org
http://kate.kde.org




More information about the kde-core-devel mailing list