[GB.FORM]

* BUG: Fix the DirView behaviour when creating a new folder.
* NEW: Replace the DirView directory combo by a label.


git-svn-id: svn://localhost/gambas/trunk@3144 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-08-27 13:50:53 +00:00
parent 7ab4ba3041
commit cfaeb4fc90
8 changed files with 116 additions and 76 deletions

View File

@ -22,15 +22,15 @@ msgstr ""
msgid "System"
msgstr ""
#: DirView.class:398
#: DirView.class:405
msgid "Cannot rename directory."
msgstr ""
#: DirView.class:419
#: DirView.class:435
msgid "New folder"
msgstr ""
#: DirView.class:435
#: DirView.class:453
msgid "Cannot create directory."
msgstr ""
@ -82,51 +82,55 @@ msgstr ""
msgid "ButtonBox1"
msgstr ""
#: FDirChooser.class:359
#: FDirChooser.class:370
msgid "All files (*)"
msgstr ""
#: FDirChooser.class:733
#: FDirChooser.class:745
msgid "&Add bookmark"
msgstr ""
#: FDirChooser.class:737
#: FDirChooser.class:749
msgid "&Remove bookmark"
msgstr ""
#: FDirChooser.class:810
#: FDirChooser.class:823
msgid "Bookmarks"
msgstr ""
#: FDirChooser.class:826
msgid "Parent directory"
msgstr ""
#: FDirChooser.class:832
msgid "Refresh"
msgstr ""
#: FDirChooser.class:838
msgid "Create directory"
#: FDirChooser.class:834
msgid "Test Test"
msgstr ""
#: FDirChooser.class:844
msgid "Parent directory"
msgstr ""
#: FDirChooser.class:850
msgid "Refresh"
msgstr ""
#: FDirChooser.class:856
msgid "Create directory"
msgstr ""
#: FDirChooser.class:862
msgid "View hidden files"
msgstr ""
#: FDirChooser.class:852
#: FDirChooser.class:870
msgid "Toggle view"
msgstr ""
#: FDirChooser.class:858
#: FDirChooser.class:876
msgid "Show files"
msgstr ""
#: FDirChooser.class:913 FInputBox.class:102 FWizard.class:59
#: FDirChooser.class:936 FInputBox.class:102 FWizard.class:59
msgid "OK"
msgstr ""
#: FDirChooser.class:919 FInputBox.class:108 FWizard.class:165
#: FDirChooser.class:942 FInputBox.class:108 FWizard.class:165
msgid "Cancel"
msgstr ""

View File

@ -1,7 +1,7 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,45,31)
MoveScaled(0,0,63,54)
Arrangement = Arrange.Fill
Spacing = True
{ Menu1 Menu
@ -18,7 +18,7 @@
Text = ("Menu5")
}
}
{ DateChooser1 DateChooser
MoveScaled(1,1,40,28)
{ DirChooser1 DirChooser
MoveScaled(3,3,56,48)
}
}

View File

@ -30,6 +30,7 @@ Private $bNoEvent As Boolean
Private $bExpandOnMouseUp As Boolean
Private $bNoExpandOnMouseUp As Boolean
Private $hTimerExpand As Timer
Private $bInRename As Boolean
Public Sub _new()
@ -91,6 +92,7 @@ Private Sub AddDir(sDir As String, sFile As String, Optional bIgnoreHidden As Bo
Dim hPict As Picture
Dim bNoEdit As Boolean
Dim sAfter As String
Dim sName As String
If Not $bShowHidden And If Left(sFile) = "." And If Not bIgnoreHidden Then Return
@ -99,14 +101,16 @@ Private Sub AddDir(sDir As String, sFile As String, Optional bIgnoreHidden As Bo
sParent = ""
hPict = $hRootPict
If Not hPict Then hPict = Picture["icon:/small/directory"]
sName = sDir &/ sFile
bNoEdit = True
Else
hPict = GetIcon(sDir &/ sFile)
sName = sFile
Endif
sAfter = FindAfter($hTreeView, sFile, sParent)
sAfter = FindAfter($hTreeView, sName, sParent)
With $hTreeView.Add(sDir &/ sFile, sFile, hPict, sParent)
With $hTreeView.Add(sDir &/ sFile, sName, hPict, sParent)
.Editable = Not bNoEdit
'DEBUG sFile; " -> "; sAfter
.MoveAfter(sAfter)
@ -172,8 +176,8 @@ End
Public Sub TreeView_Select()
If Not $bNoExpand Then
$hTimerExpand.Trigger
If Not $bNoExpand And If Not $bInRename Then
If Not $hTreeView.Current.Expanded Then $hTimerExpand.Trigger
Endif
If $bNoEvent Then Return
Raise {Select}
@ -221,6 +225,7 @@ End
Private Function Current_Read() As String
Try Return $hTreeView.Current.Key
If Error Then Return GetRoot()
End
@ -365,6 +370,8 @@ Public Sub TreeView_Rename()
Dim sNewName As String = $hTreeView.Item.Text
Dim sMsg As String
$bInRename = False
If $hTreeView.MoveParent() Then Return
$hTreeView.MoveBack()
@ -401,11 +408,19 @@ End
Public Sub TreeView_Cancel()
Dim sParent As String
$bInRename = False
If Not $bDeleteOnCancel Then Return
sParent = $hTreeView.Item.ParentKey
Try Rmdir $hTreeView.Item.Key
$hTreeView.Item.Delete
$hTreeView[sParent].Selected = True
$bDeleteOnCancel = False
End
@ -414,6 +429,7 @@ End
Public Sub NewFolder()
Dim sDir As String
Dim sPath As String
Dim iInd As Integer
sDir = ("New folder")
@ -425,13 +441,15 @@ Public Sub NewFolder()
sDir = ("New folder") & " (" & CStr(iInd) & ")"
Loop
Mkdir Current_Read() &/ sDir
sPath = Current_Read() &/ sDir
Mkdir sPath
AddDir(Current_Read(), sDir)
$bDeleteOnCancel = True
$hTreeView[Current_Read() &/ sDir].Rename
$bInRename = True
$hTreeView[sPath].Rename
Catch
Message.Error(("Cannot create directory.") & "\n\n" & Error.Text)
End

View File

@ -49,17 +49,31 @@ Public Sub _new(Optional bFile As Boolean)
End
Public Sub cmbDir_Change()
' Public Sub txtDir_Change()
'
' $sActivate = txtDir.Text
' dvwChoose.Current = txtDir.Text
'
' End
$sActivate = cmbDir.Text
dvwChoose.Current = cmbDir.Text
' Public Sub txtDir_Click()
'
' 'cmbDir_Activate
'
' End
End
Public Sub cmbDir_Click()
'cmbDir_Activate
Private Sub UpdateLabelDir()
Dim sDir As String
sDir = Mid$(dvwChoose.Current, Len(dvwChoose.Root) + 1)
If Left(sDir) <> "/" Then sDir = "/" & sDir
'sDir = Html(sDir)
sDir = Replace(sDir, "/", " ‣ ")
txtDir.Text = sDir
End
@ -67,10 +81,7 @@ Public Sub dvwChoose_Click()
If panView.Visible Then fvwChoose.Dir = dvwChoose.Current
AddToHistory(dvwChoose.Current)
Object.Lock(cmbDir)
cmbDir.Text = dvwChoose.Current
Object.Unlock(cmbDir)
UpdateLabelDir
' IF $sActivate THEN
' IF $sActivate = dvwChoose.Current THEN
@ -93,7 +104,7 @@ Public Sub Form_Open()
'DirView = dvwChoose
'FileView = fvwChoose
cmbDir.Text = dvwChoose.Current
UpdateLabelDir
If $bFile Then txtFile.SetFocus
Raise Change
@ -128,22 +139,22 @@ Public Sub btnParent_Click()
End
Private Sub AddToHistory(sDir As String)
Dim iInd As Integer
iInd = $aHistory.Find(sDir)
If iInd >= 0 Then $aHistory.Remove(iInd)
$aHistory.Add(sDir)
While $aHistory.Count > 16
$aHistory.Remove(0)
Wend
Object.Lock(cmbDir)
cmbDir.List = $aHistory
Object.Unlock(cmbDir)
End
' Private Sub AddToHistory(sDir As String)
'
' Dim iInd As Integer
'
' iInd = $aHistory.Find(sDir)
' If iInd >= 0 Then $aHistory.Remove(iInd)
' $aHistory.Add(sDir)
' While $aHistory.Count > 16
' $aHistory.Remove(0)
' Wend
'
' Object.Lock(txtDir)
' txtDir.List = $aHistory
' Object.Unlock(txtDir)
'
' End
Private Sub SetBookmark(hBookmark As CBookmark)
@ -472,6 +483,7 @@ Public Sub SetRoot(Optional sRoot As String)
If sRoot = dvwChoose.Root Then Return
dvwChoose.Root = sRoot
btnBookmark.Tooltip = sRoot
End

View File

@ -11,14 +11,13 @@
MoveScaled(0,0,79,50)
Expand = True
{ VBox1 VBox
MoveScaled(1,2,76,46)
MoveScaled(3,3,76,46)
Expand = True
Spacing = True
{ HBox1 HBox
MoveScaled(1,1,74,4)
AutoResize = True
{ btnBookmark MenuButton
MoveScaled(0,0,4,4)
MoveScaled(0,0,9,4)
ToolTip = ("Bookmarks")
AutoResize = True
Picture = Picture["icon:/small/home"]
@ -26,10 +25,14 @@
Border = False
Menu = "mnuBookmark"
}
{ cmbDir ComboBox
MoveScaled(7,0,31,4)
{ txtDir Label
MoveScaled(15,0,11,4)
Expand = True
Sorted = True
Text = ("Test Test")
}
{ Separator1 Separator
MoveScaled(36,0,1,4)
Visible = False
}
{ btnParent ToolButton
MoveScaled(38,0,4,4)
@ -64,8 +67,12 @@
Picture = Picture["icon:/small/view-split-h"]
}
}
{ Separator2 Separator
MoveScaled(30,6,11,0)
Visible = False
}
{ splChoose HSplit
MoveScaled(5,6,56,37)
MoveScaled(5,8,56,37)
Expand = True
{ dvwChoose DirView
MoveScaled(2,3,25,33)

View File

@ -37,7 +37,7 @@ SearchString=True
[OpenFile]
Active=1
File[1]=".src/MMain.module:36.2"
File[1]=".src/MMain.module:37.3"
File[2]=".src/DBusApplication.class:55.51"
File[3]=".src/DBus.class:9.0"
File[4]=".src/DBusProxy.class:22.2"

View File

@ -35,8 +35,8 @@ Public Sub Main()
'Print aVal[0];; aVal[1];; aVal[2]
'Print DBus["system://org.freedesktop.UDisks"]["/"].Children
Dim c As Collection
Dim cInts As Collection = ["image_path": "/usr/share/icons/gnome/48x48/actions/add.png"]
DBus["org.freedesktop.Notifications"]["/org/freedesktop/Notifications"].Notify("MyApp", 0, "", "PoissonTChat", "Fabien: Chu la ! <a href=\"http://gambaslinux.forumactif.net\">ici</a>", ["test"], cInts, 1000)
DBus["org.freedesktop.Notifications"]["/org/freedesktop/Notifications"].Notify("MyApp", 0, "", "PoissonTChat", "Fabien: Chu la ! <a href=\"http://gambaslinux.forumactif.net\">ici</a>", ["test"], c, 1000)
End

View File

@ -629,9 +629,10 @@ static bool try_to_load_translation(QString &locale)
&& !_translator->load(QString("qt_") + locale, QString("/usr/share/qt4/translations")));
}
static void init_lang(QString locale, bool rtl)
static void init_lang(char *lang, bool rtl)
{
int pos;
QString locale(lang);
pos = locale.lastIndexOf(".");
if (pos >= 0) locale = locale.left(pos);
@ -649,7 +650,7 @@ static void init_lang(QString locale, bool rtl)
goto __INSTALL_TRANSLATOR;
}
qDebug("warning: unable to load Qt translation: %s", QT_ToUTF8(locale));
qDebug("warning: unable to load Qt translation: %s", lang);
goto __SET_DIRECTION;
__INSTALL_TRANSLATOR:
@ -662,12 +663,10 @@ __SET_DIRECTION:
static void hook_lang(char *lang, int rtl)
{
QString locale(lang);
if (!qApp)
return;
init_lang(locale, rtl);
init_lang(lang, rtl);
//locale = QTextCodec::locale();
}