Upload-Plugin
Niko Sams <[email protected]> Mon, 21 Jan 2008 21:07:58 +0100
| Newsgroups | gmane.comp.kde.devel.quanta |
|---|---|
| Message-ID | <[email protected]> |
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 _______________________________________________ quanta-devel mailing list [email protected] https://mail.kde.org/mailman/listinfo/quanta-devel
upload.diff
(text/x-diff, 2 KB)
Index: src/quantaui.rc
===================================================================
--- src/quantaui.rc (Revision 764433)
+++ src/quantaui.rc (Arbeitskopie)
@@ -40,6 +40,9 @@
</Menu>
<Menu name="view">
<text>&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>&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-ProjectTree,Quanta-StructureTree,Quanta-TagDialogs,Quanta-TemplatesTree,UserToolbars,Console,Subversion
+List=QuantaCore,Quanta-CreateProject,Quanta-FilesTree,Quanta-Preview,Quanta-ProjectTree,Quanta-StructureTree,Quanta-TagDialogs,Quanta-TemplatesTree,UserToolbars,Console,Subversion,Quanta-Upload
+#List=AdditionalTools,CodeEditing,CodeNavigation,Console,Documentation,EditorChooser,FileCreation,FileReplace,FileSearch,GlobalFileManagement,OpenFileNavigation,OptionalCodeEditing,OutputTool,ProjectCreation,ProjectFileGroupsManagement,ProjectFileManagement,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, 11.5 KB) - not displayed
projectfilemanager.diff
(text/x-diff, 1.7 KB)
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;
+ }
}
}
}