ufolderprops.pas
来自「FMA is a free1 powerful phone editing to」· PAS 代码 · 共 1,011 行 · 第 1/3 页
PAS
1,011 行
unit uFolderProps;
{
*******************************************************************************
* Descriptions: Implementation for Explorer properties click
* $Source: /cvsroot/fma/fma/uFolderProps.pas,v $
* $Locker: $
*
* Todo:
* - remove obsolete "if (id and $F00000) = $100000" usage !!!
*
* Change Log:
* $Log: uFolderProps.pas,v $
*
}
interface
uses
Windows, TntWindows, Messages, SysUtils, TntSysUtils, Variants, Classes, TntClasses, Graphics, TntGraphics, Controls,
TntControls, Forms, TntForms, Dialogs, TntDialogs, StdCtrls, TntStdCtrls, ComCtrls, TntComCtrls, UniTntCtrls, ExtCtrls,
TntExtCtrls, GR32_Image, MPlayer, OKTThemeEngine, uFiles, Menus, TntMenus, ImgList, ImageListXP, VirtualTrees;
const
fpNone = 0;
fpPhone = 1;
fpContact = 2;
fpBookmark = 3;
fpDB = 4;
fsAlarm = 5;
type
TfrmFolderProps = class(TTntForm)
ApplyButton: TTntButton;
PageControl1: TTntPageControl;
tsGeneral: TTntTabSheet;
TntImage1: TTntImage;
TntEdit1: TTntEdit;
Timer1: TTimer;
ThemeContainer1: TOKTThemeContainer;
SaveDialog1: TTntSaveDialog;
lblName1: TTntLabel;
Button3: TTntButton;
pmEffects: TTntPopupMenu;
BlackandWhite1: TTntMenuItem;
tsFilePreview: TTntTabSheet;
TntImage2: TTntImage;
lblName2: TTntLabel;
Bevel1: TBevel;
Bevel2: TBevel;
Panel1: TPanel;
Panel2: TPanel;
pcGeneral: TTntPageControl;
tsPhone: TTntTabSheet;
lbManufacturer: TTntLabel;
lbModel: TTntLabel;
lbSWRevision: TTntLabel;
lbSerialNumber: TTntLabel;
lbvbat: TTntLabel;
lbicharge: TTntLabel;
lbcyclescharge: TTntLabel;
lbdcio: TTntLabel;
lbiphone: TTntLabel;
lblTimeLeft: TTntLabel;
lbtempbatt: TTntLabel;
lbtempphone: TTntLabel;
Label11: TTntLabel;
Label10: TTntLabel;
Label9: TTntLabel;
Label8: TTntLabel;
Label7: TTntLabel;
Label5: TTntLabel;
Label4: TTntLabel;
Label6: TTntLabel;
Label14: TTntLabel;
Label16: TTntLabel;
Label13: TTntLabel;
Label12: TTntLabel;
tsContact: TTntTabSheet;
lblContact: TTntLabel;
lblContactPrefix: TTntLabel;
tsDatabase: TTntTabSheet;
tsFile: TTntTabSheet;
Label1: TTntLabel;
lblType: TTntLabel;
Label3: TTntLabel;
lblNoCache: TTntLabel;
Label15: TTntLabel;
btnDownload: TTntButton;
edLocalFile: TTntEdit;
btnFindTarget: TTntButton;
pcFile: TTntPageControl;
tsFileImage: TTntTabSheet;
TntLabel1: TTntLabel;
imgDim: TTntImage;
TntLabel2: TTntLabel;
lblPicName: TTntLabel;
TntLabel3: TTntLabel;
lblPicSize: TTntLabel;
TntLabel4: TTntLabel;
lblPicPal: TTntLabel;
lblPicDim: TTntLabel;
PicPanel1: TTntPanel;
SelImage: TImage32;
btnEffects: TTntButton;
btnSaveImage: TTntButton;
tsFileSound: TTntTabSheet;
Label17: TTntLabel;
imgSnd: TTntImage;
lblSndType: TTntLabel;
TntLabel5: TTntLabel;
lblSndName: TTntLabel;
TntLabel6: TTntLabel;
lblSndSize: TTntLabel;
MediaPlayer1: TMediaPlayer;
tsFileTheme: TTntTabSheet;
btnSS: TTntButton;
lbPreview: TTntListBox;
Erode1: TTntMenuItem;
Dilate1: TTntMenuItem;
ApplyMosaic1: TTntMenuItem;
ApplyHSLFactor1: TTntMenuItem;
BitmapChannel1: TTntMenuItem;
btnUndoChanges: TTntButton;
lblRemoteFile: TTntLabel;
TntLabel8: TTntLabel;
btnFilters: TTntButton;
pmFilters: TTntPopupMenu;
Blur1: TTntMenuItem;
MotionBlur1: TTntMenuItem;
Soften1: TTntMenuItem;
Sharpen1: TTntMenuItem;
Emboss1: TTntMenuItem;
ThemePanel: TPanel;
ThemeViewer1: TOKTThemeViewer;
TntLabel7: TTntLabel;
lblThemeCreatorLink: TTntLabel;
TntLabel9: TTntLabel;
lblAltPEToolLink: TTntLabel;
btnSaveToPhone: TTntButton;
TntLabel10: TTntLabel;
lblSize: TTntLabel;
TntLabel12: TTntLabel;
lblContactType: TTntLabel;
ImageListXP1: TImageListXP;
tsGroup: TTntTabSheet;
btnGroupDel: TTntButton;
btnGroupAdd: TTntButton;
lvGroupMembers: TTntListView;
btnFindDB: TTntButton;
TntLabel13: TTntLabel;
lbphonedb: TTntLabel;
btnRules: TTntButton;
NoItemsPanel: TTntPanel;
lvDatabase: TTntListView;
ImageList1: TImageList;
tsAlarm: TTntTabSheet;
TntLabel11: TTntLabel;
dtAlarmTime: TTntDateTimePicker;
TntLabel14: TTntLabel;
mmoAlarmNote: TTntMemo;
TntLabel15: TTntLabel;
cbAlarmDay1: TTntCheckBox;
cbAlarmDay2: TTntCheckBox;
cbAlarmDay3: TTntCheckBox;
cbAlarmDay4: TTntCheckBox;
cbAlarmDay5: TTntCheckBox;
cbAlarmDay6: TTntCheckBox;
cbAlarmDay7: TTntCheckBox;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
var DoDefault: Boolean);
procedure btnDownloadClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure lbPreviewChange(Sender: TObject);
procedure btnSSClick(Sender: TObject);
procedure btnEffectsClick(Sender: TObject);
procedure ApplyEffectsClick(Sender: TObject);
procedure TntEdit1Change(Sender: TObject);
procedure btnFindTargetClick(Sender: TObject);
procedure btnSaveImageClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure btnUndoChangesClick(Sender: TObject);
procedure btnFiltersClick(Sender: TObject);
procedure ApplyFilterClick(Sender: TObject);
procedure LinkClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure ApplyButtonClick(Sender: TObject);
procedure btnSaveToPhoneClick(Sender: TObject);
procedure btnGroupAddClick(Sender: TObject);
procedure lvGroupMembersSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
procedure btnGroupDelClick(Sender: TObject);
procedure btnFindDBClick(Sender: TObject);
procedure btnRulesClick(Sender: TObject);
procedure FieldChange(Sender: TObject);
private
{ Private declarations }
Fullpath: string;
fFile: TFile;
FModified,FImageModified: boolean;
FRootNode: PVirtualNode;
FAlarmIndex: Integer;
procedure UpdatePhoneDetails;
procedure UpdateImageDetails;
procedure UpdateSoundDetails;
procedure DoSaveChanges;
procedure SetTab(Control: TTntPageControl; Tab: TTntTabSheet; Where: TPanel);
procedure SetRootNode(const Value: PVirtualNode);
public
{ Public declarations }
procedure OnConnectionChange(Online: boolean);
property RootNode: PVirtualNode read FRootNode write SetRootNode default nil;
end;
var
frmFolderProps: TfrmFolderProps;
implementation
uses
gnugettext, gnugettexthelpers, uThreadSafe,
ShellAPI, Unit1, uGlobal, uImg32Helper, uDialogs, uSelectContact, uSyncPhonebook,
uSIMEdit, uMEEdit, uStatusDlg, uOptionsPage,
gr32_vbeffects, gr32_vbconv;
{$R *.dfm}
procedure TfrmFolderProps.SetRootNode(const Value: PVirtualNode);
const
LastIconId: Integer = -1;
var
i,id: Integer;
Node,node2: PVirtualNode;
data,data2: PFmaExplorerNode;
w,t: WideString;
cb: TTntCheckBox;
begin
pcGeneral.ActivePageIndex := -1;
tsFilePreview.TabVisible := False;
FModified := False;
FRootNode := Value;
if Value = nil then exit;
{ Should we display 'file' properties? }
Node := Value.Parent;
while Node <> nil do begin
if Node.Parent = Form1.FNodeObex then begin
tsFilePreview.TabVisible := True; //(id and $F00000) = $500000; // this tabsheet should only be visible for files
break;
end;
Node := Node.Parent;
end;
{ Get node details }
data := Form1.ExplorerNew.GetNodeData(Value);
id := data.StateIndex;
TntEdit1.Text := data.Text;
TntEdit1Change(nil);
{ Allow phone rename if connected and root is selected }
if Value = Form1.ExplorerNew.GetFirst then begin
TntEdit1.Visible := True;
{ Get phone info }
UpdatePhoneDetails;
SetTab(pcGeneral,tsPhone,Panel1);
end;
if not Visible then begin // will be executed on dialog show (first time)
{ reset stored icon id }
LastIconId := -1;
lvDatabase.Clear;
NoItemsPanel.Visible := False;
Fullpath := Form1.GetProfilePath+'dat'; // do not localize
btnFindDB.Enabled := DirectoryExists(Fullpath);
btnRules.Visible := False;
lvDatabase.Height := btnFindDB.Top - lvDatabase.Top - 8;
// Contacts
if (id and $F00000) = $100000 then begin
lvDatabase.Items.Add.Caption := 'CallNotes.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'Contacts.ME.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'Contacts.SM.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'Contacts.SYNC.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'Contacts.SYNCMAX.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'ContactSync.xml'; // do not localize
end;
// Messages
if (id and FmaMessagesRootMask) = FmaMessagesRootFlag then begin
lvDatabase.Items.Add.Caption := 'SMSArchive.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'SMSDrafts.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'SMSInbox.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'SMSIncoming.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'SMSIncoming.Index.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'SMSOutbox.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'SMSSent.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'UserFolders.dat'; // do not localize
{ Allow Rules only for specified folders }
btnRules.Enabled := (data.StateIndex and $F00000 = FmaMessagesFmaRootFlag) and
(data.StateIndex and FmaNodeSubitemsMask = FmaMessageFolderFlag);
btnRules.Visible := True;
lvDatabase.Height := btnRules.Top - lvDatabase.Top - 8;
{ Allow renaming of Custom Folders }
TntEdit1.Visible := btnRules.Enabled;
end;
// Organizer Bookmarks
if (id and $FF0000) = $920000 then begin
lvDatabase.Items.Add.Caption := 'Bookmarks.dat'; // do not localize
lvDatabase.Items.Add.Caption := 'Bookmarks.SYNC.dat'; // do not localize
end;
// Organizer Calendar
if (id and $FF0000) = $940000 then begin
lvDatabase.Items.Add.Caption := 'Calendar.vcs'; // do not localize
lvDatabase.Items.Add.Caption := 'Calendar.SYNC.dat'; // do not localize
end;
// only for Calls-4, Files-5, Profiles-7, Groups-8 and Alarms-91
if ((id and $F00000) shr 20 in [4,5,7,8]) or ((id and $FF0000) = $910000) then begin
NoItemsPanel.Visible := True;
btnFindDB.Enabled := False;
end;
// Phones
if data.ImageIndex in [9..13] then begin
lblContactType.Caption := _('Phone number');
lblContactPrefix.Caption := _('Owner:');
data2 := Form1.ExplorerNew.GetNodeData(Value.Parent);
lblContact.Caption := data2.Text;
SetTab(pcGeneral,tsContact,Panel1);
end;
// Calls
if data.ImageIndex in [53..55] then begin
data2 := Form1.ExplorerNew.GetNodeData(Value.Parent);
lblContactType.Caption := _('Call') + ' (' + _(data2.Text) + ')';
lblContactPrefix.Caption := _('When:');
lblContact.Caption := GetToken(TStrings(data2.Data)[data.StateIndex-1],1); // HACK! See uExploreView Item.descr
SetTab(pcGeneral,tsContact,Panel1);
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?