- Timestamp:
- Dec 25, 2010, 10:28:06 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.lfm
r7 r8 1 1 object MainForm: TMainForm 2 Left = 3322 Left = 255 3 3 Height = 445 4 Top = 1064 Top = 75 5 5 Width = 649 6 6 ActiveControl = Panel1 … … 71 71 Anchors = [akTop, akLeft, akRight, akBottom] 72 72 Columns = <> 73 OwnerData = True 73 74 PopupMenu = PopupMenuItem 74 75 ReadOnly = True … … 76 77 TabOrder = 0 77 78 ViewStyle = vsReport 79 OnData = ListView1Data 78 80 OnDblClick = ListView1DblClick 79 81 OnKeyPress = ListView1KeyPress -
trunk/Forms/UMainForm.pas
r7 r8 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 9 StdCtrls, ActnList, Menus, ExtCtrls, USqlDatabase, DOM, XMLRead, XMLWrite, 10 UPersistentForm, UTreeState ;10 UPersistentForm, UTreeState, SpecializedList; 11 11 12 12 const … … 14 14 15 15 type 16 T ValueType = (vtNone, vtInteger, vtString, vtText, vtDateTime, vtFloat, vtImage, vtBoolean,16 TDbValueType = (vtNone, vtInteger, vtString, vtText, vtDateTime, vtFloat, vtImage, vtBoolean, 17 17 vtIPv4, vtMAC, vtIPv6, vtFile, vtGPS, vtEnumeration, vtHyperlink, vtPassword, 18 18 vtReference, vtDate, vtTime, vtColor); 19 20 { TReportLine } 21 22 TReportLine = class 23 Id: Integer; 24 Items: TListString; 25 constructor Create; 26 destructor Destroy; override; 27 end; 19 28 20 29 { TMainForm } … … 76 85 procedure FormDestroy(Sender: TObject); 77 86 procedure FormShow(Sender: TObject); 87 procedure ListView1Data(Sender: TObject; Item: TListItem); 78 88 procedure ListView1DblClick(Sender: TObject); 79 89 procedure ListView1KeyPress(Sender: TObject; var Key: char); … … 93 103 Database: TSQLDatabase; 94 104 TreeState: TTreeState; 105 Report: TListObject; 95 106 procedure LoadTree; 96 107 procedure LoadItemList; … … 103 114 SItemNotFound = 'Item not found'; 104 115 SObjectNotFound = 'Object not found'; 116 SGroup = 'Groups'; 105 117 106 118 … … 109 121 uses 110 122 UItemView, UItemEdit, UItemAdd; 123 124 { TReportLine } 125 126 constructor TReportLine.Create; 127 begin 128 Items := TListString.Create; 129 end; 130 131 destructor TReportLine.Destroy; 132 begin 133 Items.Free; 134 inherited Destroy; 135 end; 111 136 112 137 {$R *.lfm} … … 154 179 TreeState := TTreeState.Create; 155 180 PersistentForm := TPersistentForm.Create; 181 Report := TListObject.Create; 156 182 end; 157 183 158 184 procedure TMainForm.FormDestroy(Sender: TObject); 159 185 begin 186 Report.Free; 160 187 TreeState.Free; 161 188 Database.Free; … … 249 276 end; 250 277 278 procedure TMainForm.ListView1Data(Sender: TObject; Item: TListItem); 279 var 280 I: Integer; 281 begin 282 if Item.Index < Report.Count then 283 with TReportLine(Report[Item.Index]) do begin 284 Item.Caption := Items[0]; 285 for I := 1 to Items.Count - 1 do 286 Item.SubItems.Add(Items[I]); 287 end; 288 end; 289 251 290 procedure TMainForm.ListView1DblClick(Sender: TObject); 252 291 begin … … 271 310 begin 272 311 if Assigned(ListView1.Selected) then 273 SelectedItem := Integer(ListView1.Selected.Data)312 SelectedItem := TReportLine(Report[ListView1.Selected.Index]).Id 274 313 else SelectedItem := 0; 275 314 … … 307 346 TreeState.SaveTree(TreeView1); 308 347 Clear; 309 AddChild(nil, 'Skupiny');348 AddChild(nil, SGroup); 310 349 TopItem.ImageIndex := 0; 311 350 TopItem.SelectedIndex := 0; … … 346 385 I: Integer; 347 386 C: Integer; 348 NewItem: T ListItem;387 NewItem: TReportLine; 349 388 NewColumn: TListColumn; 350 389 begin 351 390 SelectedObject := 0; 352 if Assigned(TreeView1.Selected) then353 with ListView1 , Itemsdo begin391 if Assigned(TreeView1.Selected) then 392 with ListView1 do begin 354 393 Visible := True; 355 Clear;394 Report.Clear; 356 395 try 357 396 DbRows := TDbRows.Create; … … 372 411 NewColumn.Caption := Properties[I].Values['Name']; 373 412 end; 413 414 ListView1Resize(Self); 415 416 // Load items 417 Values := TDbRows.Create; 418 Database.Query(Values, 'SELECT * FROM `' + DbRows[0].Values['Schema'] + '`.`' + 419 DbRows[0].Values['Table'] + '`'); 420 for I := 0 to Values.Count - 1 do begin 421 NewItem := TReportLine.Create; 422 NewItem.Items.Add(Values[I].Values[DbRows[0].Values['PrimaryKey']]); 423 NewItem.Id := StrToInt(Values[I].Values[DbRows[0].Values['PrimaryKey']]); 424 for C := 0 to Properties.Count - 1 do begin 425 NewItem.Items.Add(Values[I].Values[Properties[C].Values['ColumnName']]); 426 end; 427 Report.Add(NewItem); 428 end; 429 Items.Count := Values.Count; 430 Refresh; 374 431 finally 375 432 Properties.Free; 376 end;377 378 ListView1Resize(Self);379 380 // Load items381 try382 Values := TDbRows.Create;383 Database.Query(Values, 'SELECT * FROM `' + DbRows[0].Values['Schema'] + '`.`' +384 DbRows[0].Values['Table'] + '`');385 for I := 0 to Values.Count - 1 do begin386 NewItem := Items.Add;387 NewItem.Caption := Values[I].Values[DbRows[0].Values['PrimaryKey']];388 NewItem.Data := Pointer(StrToInt(Values[I].Values[DbRows[0].Values['PrimaryKey']]));389 for C := 0 to Properties.Count - 1 do begin390 NewItem.SubItems.Add(Values[I].Values[Properties[C].Values['ColumnName']]);391 end;392 end;393 finally394 433 Values.Free; 395 434 end; -
trunk/chronis.lpi
r7 r8 43 43 </Item2> 44 44 </RequiredPackages> 45 <Units Count="1 3">45 <Units Count="18"> 46 46 <Unit0> 47 47 <Filename Value="chronis.lpr"/> … … 56 56 <Loaded Value="True"/> 57 57 <LoadedDesigner Value="True"/> 58 <DefaultSyntaxHighlighter Value="Delphi"/> 58 59 </Unit0> 59 60 <Unit1> … … 64 65 <CursorPos X="1" Y="347"/> 65 66 <UsageCount Value="52"/> 67 <DefaultSyntaxHighlighter Value="Delphi"/> 66 68 </Unit1> 67 69 <Unit2> … … 75 77 <CursorPos X="25" Y="144"/> 76 78 <UsageCount Value="106"/> 79 <DefaultSyntaxHighlighter Value="Delphi"/> 77 80 </Unit2> 78 81 <Unit3> … … 86 89 <CursorPos X="24" Y="14"/> 87 90 <UsageCount Value="106"/> 91 <DefaultSyntaxHighlighter Value="Delphi"/> 88 92 </Unit3> 89 93 <Unit4> … … 95 99 <CursorPos X="33" Y="46"/> 96 100 <UsageCount Value="264"/> 101 <DefaultSyntaxHighlighter Value="Delphi"/> 97 102 </Unit4> 98 103 <Unit5> … … 102 107 <EditorIndex Value="2"/> 103 108 <WindowIndex Value="0"/> 104 <TopLine Value=" 50"/>105 <CursorPos X=" 5" Y="45"/>109 <TopLine Value="362"/> 110 <CursorPos X="1" Y="424"/> 106 111 <UsageCount Value="264"/> 107 112 <Loaded Value="True"/> 113 <DefaultSyntaxHighlighter Value="Delphi"/> 108 114 </Unit5> 109 115 <Unit6> … … 115 121 <CursorPos X="21" Y="13"/> 116 122 <UsageCount Value="264"/> 123 <DefaultSyntaxHighlighter Value="Delphi"/> 117 124 </Unit6> 118 125 <Unit7> … … 122 129 <ResourceBaseClass Value="Form"/> 123 130 <UnitName Value="UItemView"/> 124 <IsVisibleTab Value="True"/>125 131 <EditorIndex Value="0"/> 126 132 <WindowIndex Value="0"/> 127 <TopLine Value=" 76"/>128 <CursorPos X="3 7" Y="98"/>133 <TopLine Value="1"/> 134 <CursorPos X="32" Y="95"/> 129 135 <UsageCount Value="327"/> 130 136 <Loaded Value="True"/> 131 137 <LoadedDesigner Value="True"/> 138 <DefaultSyntaxHighlighter Value="Delphi"/> 132 139 </Unit7> 133 140 <Unit8> … … 137 144 <ResourceBaseClass Value="Form"/> 138 145 <UnitName Value="UItemEdit"/> 146 <IsVisibleTab Value="True"/> 139 147 <EditorIndex Value="1"/> 140 148 <WindowIndex Value="0"/> 141 <TopLine Value="8 0"/>142 <CursorPos X=" 30" Y="93"/>149 <TopLine Value="89"/> 150 <CursorPos X="1" Y="111"/> 143 151 <UsageCount Value="318"/> 144 152 <Loaded Value="True"/> 145 153 <LoadedDesigner Value="True"/> 154 <DefaultSyntaxHighlighter Value="Delphi"/> 146 155 </Unit8> 147 156 <Unit9> … … 152 161 <ResourceBaseClass Value="Form"/> 153 162 <UnitName Value="ULoginForm"/> 154 <EditorIndex Value=" 5"/>163 <EditorIndex Value="10"/> 155 164 <WindowIndex Value="0"/> 156 165 <TopLine Value="1"/> … … 159 168 <Loaded Value="True"/> 160 169 <LoadedDesigner Value="True"/> 170 <DefaultSyntaxHighlighter Value="Delphi"/> 161 171 </Unit9> 162 172 <Unit10> … … 167 177 <ResourceBaseClass Value="Form"/> 168 178 <UnitName Value="UMainForm"/> 169 <EditorIndex Value=" 3"/>170 <WindowIndex Value="0"/> 171 <TopLine Value="3 72"/>172 <CursorPos X=" 30" Y="383"/>179 <EditorIndex Value="5"/> 180 <WindowIndex Value="0"/> 181 <TopLine Value="300"/> 182 <CursorPos X="69" Y="312"/> 173 183 <UsageCount Value="317"/> 174 184 <Loaded Value="True"/> 175 185 <LoadedDesigner Value="True"/> 186 <DefaultSyntaxHighlighter Value="Delphi"/> 176 187 </Unit10> 177 188 <Unit11> … … 180 191 <UnitName Value="UTreeState"/> 181 192 <UsageCount Value="314"/> 193 <DefaultSyntaxHighlighter Value="Delphi"/> 182 194 </Unit11> 183 195 <Unit12> … … 187 199 <ResourceBaseClass Value="Form"/> 188 200 <UnitName Value="UItemAdd"/> 189 <EditorIndex Value=" 4"/>201 <EditorIndex Value="9"/> 190 202 <WindowIndex Value="0"/> 191 203 <TopLine Value="69"/> … … 194 206 <Loaded Value="True"/> 195 207 <LoadedDesigner Value="True"/> 208 <DefaultSyntaxHighlighter Value="Delphi"/> 196 209 </Unit12> 210 <Unit13> 211 <Filename Value="/usr/share/fpcsrc/rtl/objpas/classes/classesh.inc"/> 212 <EditorIndex Value="8"/> 213 <WindowIndex Value="0"/> 214 <TopLine Value="963"/> 215 <CursorPos X="3" Y="974"/> 216 <UsageCount Value="11"/> 217 <Loaded Value="True"/> 218 </Unit13> 219 <Unit14> 220 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericDictionary.inc"/> 221 <EditorIndex Value="3"/> 222 <WindowIndex Value="0"/> 223 <TopLine Value="75"/> 224 <CursorPos X="1" Y="89"/> 225 <UsageCount Value="10"/> 226 <Loaded Value="True"/> 227 </Unit14> 228 <Unit15> 229 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericList.inc"/> 230 <EditorIndex Value="4"/> 231 <WindowIndex Value="0"/> 232 <TopLine Value="387"/> 233 <CursorPos X="1" Y="407"/> 234 <UsageCount Value="10"/> 235 <Loaded Value="True"/> 236 </Unit15> 237 <Unit16> 238 <Filename Value="../../../lazarus/trunk/lcl/forms.pp"/> 239 <UnitName Value="Forms"/> 240 <EditorIndex Value="6"/> 241 <WindowIndex Value="0"/> 242 <TopLine Value="593"/> 243 <CursorPos X="15" Y="606"/> 244 <UsageCount Value="10"/> 245 <Loaded Value="True"/> 246 </Unit16> 247 <Unit17> 248 <Filename Value="../../../lazarus/trunk/lcl/include/customform.inc"/> 249 <EditorIndex Value="7"/> 250 <WindowIndex Value="0"/> 251 <TopLine Value="2104"/> 252 <CursorPos X="3" Y="2109"/> 253 <UsageCount Value="10"/> 254 <Loaded Value="True"/> 255 </Unit17> 197 256 </Units> 198 257 <JumpHistory Count="30" HistoryIndex="29"> 199 258 <Position1> 200 <Filename Value=" Forms/UItemAdd.pas"/>201 <Caret Line=" 9" Column="27" TopLine="1"/>259 <Filename Value="Common/USqlDatabase.pas"/> 260 <Caret Line="424" Column="1" TopLine="407"/> 202 261 </Position1> 203 262 <Position2> 204 <Filename Value=" Forms/UItemAdd.pas"/>205 <Caret Line=" 138" Column="28" TopLine="116"/>263 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericDictionary.inc"/> 264 <Caret Line="59" Column="1" TopLine="46"/> 206 265 </Position2> 207 266 <Position3> 208 <Filename Value=" Forms/UItemEdit.pas"/>209 <Caret Line=" 137" Column="16" TopLine="125"/>267 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericDictionary.inc"/> 268 <Caret Line="60" Column="1" TopLine="46"/> 210 269 </Position3> 211 270 <Position4> 212 <Filename Value=" Forms/UItemEdit.pas"/>213 <Caret Line=" 78" Column="23" TopLine="56"/>271 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericDictionary.inc"/> 272 <Caret Line="61" Column="1" TopLine="46"/> 214 273 </Position4> 215 274 <Position5> 216 275 <Filename Value="Forms/UMainForm.pas"/> 217 <Caret Line=" 339" Column="43" TopLine="214"/>276 <Caret Line="429" Column="1" TopLine="411"/> 218 277 </Position5> 219 278 <Position6> 220 <Filename Value=" Forms/UMainForm.pas"/>221 <Caret Line=" 340" Column="43" TopLine="317"/>279 <Filename Value="Common/USqlDatabase.pas"/> 280 <Caret Line="423" Column="1" TopLine="407"/> 222 281 </Position6> 223 282 <Position7> 224 <Filename Value=" Forms/UMainForm.pas"/>225 <Caret Line=" 341" Column="43" TopLine="318"/>283 <Filename Value="Common/USqlDatabase.pas"/> 284 <Caret Line="424" Column="1" TopLine="407"/> 226 285 </Position7> 227 286 <Position8> 228 <Filename Value=" Forms/UMainForm.pas"/>229 <Caret Line=" 342" Column="43" TopLine="319"/>287 <Filename Value="Common/USqlDatabase.pas"/> 288 <Caret Line="423" Column="1" TopLine="407"/> 230 289 </Position8> 231 290 <Position9> 232 <Filename Value=" Forms/UMainForm.pas"/>233 <Caret Line=" 343" Column="43" TopLine="320"/>291 <Filename Value="Common/USqlDatabase.pas"/> 292 <Caret Line="424" Column="1" TopLine="407"/> 234 293 </Position9> 235 294 <Position10> 236 <Filename Value=" Forms/UMainForm.pas"/>237 <Caret Line=" 344" Column="43" TopLine="321"/>295 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericDictionary.inc"/> 296 <Caret Line="59" Column="1" TopLine="46"/> 238 297 </Position10> 239 298 <Position11> 240 <Filename Value=" Forms/UMainForm.pas"/>241 <Caret Line=" 345" Column="43" TopLine="322"/>299 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericDictionary.inc"/> 300 <Caret Line="60" Column="1" TopLine="46"/> 242 301 </Position11> 243 302 <Position12> 244 <Filename Value=" Forms/UMainForm.pas"/>245 <Caret Line=" 346" Column="43" TopLine="323"/>303 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericDictionary.inc"/> 304 <Caret Line="88" Column="1" TopLine="75"/> 246 305 </Position12> 247 306 <Position13> 248 307 <Filename Value="Forms/UMainForm.pas"/> 249 <Caret Line=" 345" Column="43" TopLine="322"/>308 <Caret Line="292" Column="12" TopLine="282"/> 250 309 </Position13> 251 310 <Position14> 252 311 <Filename Value="Forms/UMainForm.pas"/> 253 <Caret Line=" 344" Column="43" TopLine="321"/>312 <Caret Line="204" Column="18" TopLine="202"/> 254 313 </Position14> 255 314 <Position15> 256 <Filename Value="Forms/U MainForm.pas"/>257 <Caret Line=" 345" Column="43" TopLine="322"/>315 <Filename Value="Forms/UItemView.pas"/> 316 <Caret Line="67" Column="13" TopLine="55"/> 258 317 </Position15> 259 318 <Position16> 260 319 <Filename Value="Forms/UMainForm.pas"/> 261 <Caret Line=" 352" Column="43" TopLine="329"/>320 <Caret Line="16" Column="41" TopLine="4"/> 262 321 </Position16> 263 322 <Position17> 264 323 <Filename Value="Forms/UMainForm.pas"/> 265 <Caret Line=" 218" Column="1" TopLine="195"/>324 <Caret Line="50" Column="25" TopLine="28"/> 266 325 </Position17> 267 326 <Position18> 268 327 <Filename Value="Forms/UMainForm.pas"/> 269 <Caret Line=" 79" Column="21" TopLine="67"/>328 <Caret Line="87" Column="23" TopLine="65"/> 270 329 </Position18> 271 330 <Position19> 272 331 <Filename Value="Forms/UMainForm.pas"/> 273 <Caret Line="8 1" Column="21" TopLine="69"/>332 <Caret Line="88" Column="23" TopLine="66"/> 274 333 </Position19> 275 334 <Position20> 276 <Filename Value="Forms/U ItemView.pas"/>277 <Caret Line=" 118" Column="39" TopLine="98"/>335 <Filename Value="Forms/UMainForm.pas"/> 336 <Caret Line="89" Column="23" TopLine="67"/> 278 337 </Position20> 279 338 <Position21> 280 <Filename Value="Forms/U ItemEdit.pas"/>281 <Caret Line=" 39" Column="1" TopLine="26"/>339 <Filename Value="Forms/UMainForm.pas"/> 340 <Caret Line="90" Column="23" TopLine="68"/> 282 341 </Position21> 283 342 <Position22> 284 <Filename Value="Forms/U ItemEdit.pas"/>285 <Caret Line=" 81" Column="31" TopLine="70"/>343 <Filename Value="Forms/UMainForm.pas"/> 344 <Caret Line="91" Column="23" TopLine="69"/> 286 345 </Position22> 287 346 <Position23> 288 <Filename Value="Forms/U ItemAdd.pas"/>289 <Caret Line=" 153" Column="39" TopLine="2"/>347 <Filename Value="Forms/UMainForm.pas"/> 348 <Caret Line="278" Column="29" TopLine="265"/> 290 349 </Position23> 291 350 <Position24> 292 351 <Filename Value="Forms/UMainForm.pas"/> 293 <Caret Line=" 102" Column="1" TopLine="91"/>352 <Caret Line="290" Column="29" TopLine="277"/> 294 353 </Position24> 295 354 <Position25> 296 355 <Filename Value="Forms/UMainForm.pas"/> 297 <Caret Line=" 138" Column="26" TopLine="125"/>356 <Caret Line="295" Column="29" TopLine="277"/> 298 357 </Position25> 299 358 <Position26> 300 359 <Filename Value="Forms/UMainForm.pas"/> 301 <Caret Line=" 136" Column="30" TopLine="125"/>360 <Caret Line="300" Column="29" TopLine="287"/> 302 361 </Position26> 303 362 <Position27> 304 363 <Filename Value="Forms/UMainForm.pas"/> 305 <Caret Line="3 14" Column="30" TopLine="302"/>364 <Caret Line="304" Column="25" TopLine="287"/> 306 365 </Position27> 307 366 <Position28> 308 367 <Filename Value="Forms/UMainForm.pas"/> 309 <Caret Line="3 43" Column="11" TopLine="322"/>368 <Caret Line="305" Column="63" TopLine="287"/> 310 369 </Position28> 311 370 <Position29> 312 371 <Filename Value="Forms/UMainForm.pas"/> 313 <Caret Line="3 68" Column="9" TopLine="346"/>372 <Caret Line="308" Column="29" TopLine="287"/> 314 373 </Position29> 315 374 <Position30> 316 <Filename Value="Forms/U ItemView.pas"/>317 <Caret Line=" 86" Column="24" TopLine="80"/>375 <Filename Value="Forms/UMainForm.pas"/> 376 <Caret Line="312" Column="69" TopLine="300"/> 318 377 </Position30> 319 378 </JumpHistory> … … 330 389 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 331 390 </SearchPaths> 391 <Parsing> 392 <SyntaxOptions> 393 <SyntaxMode Value="Delphi"/> 394 <CStyleOperator Value="False"/> 395 <AllowLabel Value="False"/> 396 <CPPInline Value="False"/> 397 </SyntaxOptions> 398 </Parsing> 332 399 <CodeGeneration> 333 400 <Checks> … … 341 408 <Debugging> 342 409 <GenerateDebugInfo Value="True"/> 410 <UseHeaptrc Value="True"/> 343 411 </Debugging> 344 412 <Options> … … 350 418 <Other> 351 419 <CompilerMessages> 420 <IgnoredMessages idx5023="True" idx5024="True" idx5025="True" idx5028="True" idx5029="True" idx5031="True"/> 352 421 <UseMsgFile Value="True"/> 353 422 </CompilerMessages> -
trunk/languages/chronis.cs.po
r7 r8 177 177 msgstr "Server" 178 178 179 #: umainform.sgroup 180 msgid "Groups" 181 msgstr "" 182 179 183 #: umainform.sitemnotfound 180 184 msgid "Item not found" -
trunk/languages/chronis.po
r7 r8 147 147 msgstr "" 148 148 149 #: umainform.sgroup 150 msgid "Groups" 151 msgstr "" 152 149 153 #: umainform.sitemnotfound 150 154 msgid "Item not found"
Note:
See TracChangeset
for help on using the changeset viewer.