[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Create folder the KDE way
From: Christoffer Brodd-Reijer <ephracis () linux ! se>
Date: 2006-02-23 12:34:56
Message-ID: 43FDABF0.9080400 () linux ! se
[Download RAW message or body]
Andras Mantia wrote:
> On Wednesday 22 February 2006 22:54, Christoffer Brodd-Reijer wrote:
>> Is there a KDEish way to create a folder? I have a popup menu with a
>> "New folder" action. Should I create my own dialog containing a line
>> edit and so on or can I reuse some KDE dialog?
>
> If you followed Jens' suggestion and looked at Quanta code
> (http://websvn.kde.org/brances/KDE/3.5kdewebdev/quanta/treeviews/basetreeview.cpp)
> you could see that we are doing the same thing there. Shortly, to have
> a dialog we use:
>
> bool ok;
> QString folderName = KInputDialog::getText(i18n("Create New Folder"),
> i18n("Folder name:"), "", &ok, this);
> if (ok)
> {
> KURL url = currentURL();
> if (currentKFileTreeViewItem()->isDir())
> url.setPath(url.path() + "/" + folderName + "/");
> else
> url.setPath(url.directory() + "/" + folderName +"/");
> QuantaNetAccess::mkdir(url, this, -1);
> }
>
> Replace QuantaNetAccess:: with KNetAccess or some other code (if you
> want recursive directory creation, see kdewebdev/libs/qextfileinfo.*
> for an example). currentURL() is the URL of the current item in the
> listview.
>
> Andras
Thank you. The basetreeview was a bit too heavy for me but I understand
what you mean and that QuantaNetAccess (or KNetAccess) is new to me, and
it seems interesting.
Thank you for point it out to me.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic