[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quanta-devel
Subject:    [quanta-devel] Upload-Plugin
From:       Niko Sams <niko.sams () gmail ! com>
Date:       2008-01-21 20:07:58
Message-ID: 200801212107.58712.niko.sams () gmail ! com
[Download RAW message or body]

Hello,

I did some work on an upload plugin for Quanta4. And I'm asking you now to
review my code - this is the first time I'm working with KConfig, KIO, KDevelop...
I tested it with quanta - but it should work also with kdevelop - as it has no dependencies
on quanta.

Installation:
Apply the attached upload.diff to quanta and extract upload.tar.gz.
Additionally a small fix for quanta projectfilemanager.diff I made - it adds folders
as folders and not files to the project.

Usage:
- open a project
- Settings -> Configure Project
- Upload, edit profiles there
- rightclick a project-item, select upload

Uploadprofiles and times of uploads will be saved in the developer-project-config.

And now my questions:
- where could a upload-action be placed? (Context-Menu for the project-items is
   not very intuitive - it should be in some menu)
   But how does such a action know what project is active?
- Is the model-proxy approach I made with UploadProjectModel a good idea?
- three files are linked into the plugin and the pref-plugin; can i avoid this?
- uploaddialog.cpp:176 is that working?


Please tell me whats good/bad about the plugin - and for what parts there would
be a easier/better solultion...


Niko

["upload.diff" (text/x-diff)]

Index: src/quantaui.rc
===================================================================
--- src/quantaui.rc	(Revision 764433)
+++ src/quantaui.rc	(Arbeitskopie)
@@ -40,6 +40,9 @@
   </Menu>
   <Menu name="view">
     <text>&amp;View</text>
+    <Action name="add_toolview"/>
+    <Action name="remove_view"/>
+    <Action name="user_interface"/>
     <DefineGroup name="history_operations"/>
     <Action name="history_back"/>
     <Action name="history_forward"/>
@@ -119,6 +122,8 @@
     <Action name="settings_configure_editors" />
     <Action name="settings_configure" />
     <DefineGroup name="configure_merge" />
+    <Separator />
+    <Action name="project_config_menu" />
   </Menu>
   <Menu name="help" append="about_merge">
     <text>&amp;Help</text>
Index: src/profile.config
===================================================================
--- src/profile.config	(Revision 764433)
+++ src/profile.config	(Arbeitskopie)
@@ -9,6 +9,6 @@
 GenericName=quanta
 
 [Properties]
-List=QuantaCore,Quanta-CreateProject,Quanta-FilesTree,Quanta-Preview,Quanta-ProjectTr \
ee,Quanta-StructureTree,Quanta-TagDialogs,Quanta-TemplatesTree,UserToolbars,Console,Subversion
 +List=QuantaCore,Quanta-CreateProject,Quanta-FilesTree,Quanta-Preview,Quanta-ProjectT \
ree,Quanta-StructureTree,Quanta-TagDialogs,Quanta-TemplatesTree,UserToolbars,Console,Subversion,Quanta-Upload
 +#List=AdditionalTools,CodeEditing,CodeNavigation,Console,Documentation,EditorChooser \
,FileCreation,FileReplace,FileSearch,GlobalFileManagement,OpenFileNavigation,OptionalC \
odeEditing,OutputTool,ProjectCreation,ProjectFileGroupsManagement,ProjectFileManagemen \
t,UISwitching,ViewManagement,CVSService,ClearcaseVCS,PerforceVCS,Subversion,ProjectPackaging,VCS,DUChainNavigation
  
-
Index: plugins/CMakeLists.txt
===================================================================
--- plugins/CMakeLists.txt	(Revision 764433)
+++ plugins/CMakeLists.txt	(Arbeitskopie)
@@ -7,4 +7,5 @@
 add_subdirectory( templatestree )
 add_subdirectory( preview )
 add_subdirectory( usertoolbars )
+add_subdirectory( upload )
 


["upload.tar.gz" (application/x-tgz)]
["projectfilemanager.diff" (text/x-diff)]

Index: plugins/project/projectfilemanager/quantaprojectfilemanager.cpp
===================================================================
--- plugins/project/projectfilemanager/quantaprojectfilemanager.cpp	(Revision 762171)
+++ plugins/project/projectfilemanager/quantaprojectfilemanager.cpp	(Arbeitskopie)
@@ -112,6 +112,7 @@
                 el.setAttribute("uploadstatus", 1);
               //remove non-existent local files
               bool skipItem = false;
+              bool isDir = false;
               if (url.isLocalFile())
               {
                 QFileInfo fi(url.path());
@@ -121,6 +122,10 @@
                   i--;
                   skipItem = true;
                 }
+                if ( fi.isDir() )
+                {
+                  isDir = true;
+                }
               }
               if (!skipItem)
               {
@@ -149,9 +154,23 @@
                   }
                   parent = url;
                 }
-              // add the file
-                kDebug(24000) << "Adding file: " << fileUrl;
-                m_projectFiles[parent] << fileUrl;
+              
+                if ( isDir )
+                {
+                  // add the folder
+                  if (!m_projectFiles.contains(fileUrl))
+                  {
+                    kDebug(24000) << "Adding folder: " << fileUrl;
+                    m_projectFiles[fileUrl] = QStringList();
+                    m_projectFolders[parent] << fileUrl;
+                  }
+                }
+                else
+                {
+                  // add the file
+                  kDebug(24000) << "Adding file: " << fileUrl;
+                  m_projectFiles[parent] << fileUrl;
+                }
               }
             }
           }


_______________________________________________
quanta-devel mailing list
quanta-devel@kde.org
https://mail.kde.org/mailman/listinfo/quanta-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic