mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-28 06:12:53 -06:00
Add missing NewPackageFile.cpp
git-svn-id: svn://ultimatepp.org/upp/trunk@9890 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
11d4fad8b6
commit
eb611440d6
1 changed files with 56 additions and 0 deletions
56
uppsrc/ide/NewPackageFile.cpp
Normal file
56
uppsrc/ide/NewPackageFile.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#include "ide.h"
|
||||
|
||||
class NewPackageFileWindow : public WithNewPackageFileLayout<TopWindow> {
|
||||
typedef NewPackageFileWindow CLASSNAME;
|
||||
|
||||
public:
|
||||
NewPackageFileWindow(const String& packageDir);
|
||||
|
||||
String GetFileName() const;
|
||||
|
||||
private:
|
||||
void CheckFilePath();
|
||||
|
||||
private:
|
||||
String packageDir;
|
||||
};
|
||||
|
||||
NewPackageFileWindow::NewPackageFileWindow(const String& packageDir)
|
||||
: packageDir(packageDir)
|
||||
{
|
||||
CtrlLayoutOKCancel(*this, "New package file");
|
||||
|
||||
fileName <<= THISBACK(CheckFilePath);
|
||||
|
||||
ok.Disable();
|
||||
}
|
||||
|
||||
void NewPackageFileWindow::CheckFilePath()
|
||||
{
|
||||
String file = fileName.GetData();
|
||||
|
||||
info.Clear();
|
||||
if (file.IsEmpty()) {
|
||||
ok.Disable();
|
||||
}
|
||||
else
|
||||
if (FileExists(packageDir + DIR_SEPS + file)) {
|
||||
ok.Disable();
|
||||
info.SetData("[ [ [@(170.42.0) File already exists.]]]");
|
||||
}
|
||||
else {
|
||||
ok.Enable();
|
||||
}
|
||||
}
|
||||
|
||||
String NewPackageFileWindow::GetFileName() const
|
||||
{
|
||||
return fileName.GetData();
|
||||
}
|
||||
|
||||
void WorkspaceWork::NewPackageFile()
|
||||
{
|
||||
NewPackageFileWindow dlg(GetFileFolder(GetActivePackagePath()));
|
||||
if (dlg.ExecuteOK())
|
||||
AddItem(dlg.GetFileName(), false, false);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue