File indexing completed on 2024-05-12 15:59:57

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Agata Cacko <cacko.azh@gmail.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_RESOURCE_OVERWRITE_DIALOG_H
0008 #define KIS_RESOURCE_OVERWRITE_DIALOG_H
0009 
0010 #include <QWidget>
0011 #include "kritaresourcewidgets_export.h"
0012 #include <KoResource.h>
0013 #include <KisResourceModel.h>
0014 
0015 
0016 class KRITARESOURCEWIDGETS_EXPORT KisResourceUserOperations
0017 {
0018 
0019 public:
0020     // used when the user tries to import or create a new resource that already exists
0021     // for example if they import the same resource file (the filename matches)
0022     // or when they try to create a new resource with the same name and filename
0023     static bool userAllowsOverwrite(QWidget* widgetParent, QString resourceFilepath);
0024     static bool resourceNameIsAlreadyUsed(KisResourceModel* resourceModel, QString resourceName, int resourceIdToIgnore = -1);
0025 
0026     // used when the user tries to rename a resource to a name that already exists
0027     // (it's permitted but can confuse the user later)
0028     static bool userAllowsRename(QWidget* widgetParent, QString name);
0029 
0030 
0031 
0032     static KoResourceSP importResourceFileWithUserInput(QWidget *widgetParent, QString storageLocation, QString resourceType, QString resourceFilepath);
0033     static bool renameResourceWithUserInput(QWidget* widgetParent, KoResourceSP resource, QString resourceName);
0034     static bool addResourceWithUserInput(QWidget* widgetParent, KoResourceSP resource, QString storageLocation = "");
0035     static bool updateResourceWithUserInput(QWidget* widgetParent, KoResourceSP resource);
0036 
0037 
0038 
0039 
0040 };
0041 
0042 #endif // KIS_RESOURCE_OVERWRITE_DIALOG_H