DumontEXE 0.0.1
cmcFormScript.cpp
00001 /* ***************************************************************************
00002 **
00003 ** Copyright (C) 2007 Lorimark Solutions, LLC. All rights reserved.
00004 **
00005 ** This file is part of the DumontEXE Scripting Extension Kit
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://dumont.showoff-db.org/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://dumont.showoff-db.org/licensing.html 
00017 ** or contact the sales department at sales@lorimarksolutions.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ** author: Mark Petryk ~ Lorimark Solutions, LLC
00023 ** **************************************************************************/
00024 
00025 #include <QUuid>
00026 #include <QDir>
00027 
00028 #include "cmcFormDef.h"
00029 #include "cmcFormScript.h"
00030 #include "cmcApplication.h"
00031 #include "cmcApplications.h"
00032 #include "cmcStringList.h"
00033 
00034 namespace cmcDatabaseApi {
00035 
00036 cmcFormScript::cmcFormScript( const cmcFormScript & copy ):
00037   cmcStringList( copy )
00038 {
00039 }
00040 
00041 cmcFormScript::cmcFormScript
00042 (
00043   cmcFormDef * formDef
00044 ):
00045   cmcStringList( 1, formDef )
00046 {
00047 }
00048 
00049 cmcFormScript::~cmcFormScript()
00050 {
00051 }
00052 
00053 cmcFormDef * cmcFormScript::formDef()
00054 {
00055   return( qobject_cast<cmcFormDef*>(parent()) );
00056 }
00057 
00058 cmcApplication * cmcFormScript::app()
00059 {
00060   return( formDef()-> app() );
00061 }
00062 
00063 QString cmcFormScript::folder()
00064 {
00065   return
00066   (
00067     app()-> databaseDirectory() + "\\Dumont"
00068   );
00069 }
00070 
00071 QString cmcFormScript::fileName()
00072 {
00073   return
00074   (
00075     formDef()-> categoryName() + "(" +
00076     formDef()-> name()         + ").bas"
00077   );
00078 }
00079 
00080 QString cmcFormScript::absolutePath()
00081 {
00082   return( folder() + "\\" + fileName() );
00083 }
00084 
00085 
00086 bool cmcFormScript::checkOut()
00087 {
00088   /*
00089   ** Check dir and create it if it exists
00090   **
00091   */
00092   QDir dir(folder());
00093 
00094   if( !dir.exists() )
00095     dir.mkpath( folder() );
00096 
00097   return( formDef()-> checkOutFormScript( absolutePath() ) );
00098 }
00099 
00100 bool cmcFormScript::checkIn()
00101 {
00102   QDir dir(folder());
00103 
00104   if( !dir.exists() )
00105     dir.mkpath( folder() );
00106 
00107   if( !dir.exists( fileName() ) )
00108     return( false );
00109 
00110   return( formDef()-> checkInFormScript( absolutePath() ) );
00111 }
00112 
00113 bool cmcFormScript::load()
00114 {
00115   /*
00116   ** Set paths
00117   **
00118   */
00119   QString scriptFolder = app()-> databaseDirectory() + "\\Dumont";
00120   QString scriptFile   = scriptFolder + "\\" + formDef()-> name() + ".vbs";
00121 
00122   /*
00123   ** Check dir and create it if it exists
00124   **
00125   */
00126   QDir dir(scriptFolder);
00127 
00128   if( !dir.exists() )
00129   {
00130     dir.mkpath( scriptFolder );
00131   }
00132 
00133   formDef()-> checkOutFormScript( scriptFile );
00134 
00135   return( true );
00136 }
00137 
00138 bool cmcFormScript::save()
00139 {
00140   return( false );
00141 }
00142 
00143 
00144 } // endnamespace cmcDatabaseApi
00145 
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com